<aside> 💡

이러한 빵을 받게 되면 지게된다.
즉, 저러한 빵을 둘러쌓고 있는 $6$개의 면의 층의 개수를 적절히 잘라 상대에게 지는 빵을 넘겨주는 게임이다.
이는 돌 무더기가 $6$개인 스그라프-그런디로 해결할 수 있다.
마지막으로 빵을 자르는 사람이 지게 된다. 자르는 방법 총 $3$가지다. ($X, Y, Z$축에 평행하게)
이 또한 돌 무더기가 $3$개인 스그라프-그런디로 해결할 수 있다.
</aside>
#include <bits/stdc++.h>
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
using namespace std;
typedef long long ll;
int X, Y, Z, n;
tuple<int, int, int> xyz[101];
int a[6];
void solve()
{
cin >> X >> Y >> Z >> n;
int x1 = X;
int x2 = 0;
int y1 = Y;
int y2 = 0;
int z1 = Z;
int z2 = 0;
for(int i = 0; i<n; i++){
int x, y, z;
cin >> x >> y >> z;
x1 = min(x1, x);
x2 = max(x2, x);
y1 = min(y1, y);
y2 = max(y2, y);
z1 = min(z1, z);
z2 = max(z2, z);
}
if(n == 0){
if((X-1)^(Y-1)^(Z-1)) cout << "Alice\\n";
else cout << "Bob\\n";
return;
}
a[0] = x1-1;
a[1] = X-x2;
a[2] = y1-1;
a[3] = Y-y2;
a[4] = z1-1;
a[5] = Z-z2;
int sg = a[0]^a[1]^a[2]^a[3]^a[4]^a[5];
if(sg) cout << "Alice\\n";
else cout << "Bob\\n";
}
signed main()
{
FASTIO;
int tc; cin >> tc;
while(tc--) solve();
return 0;
}