# Play Games 4

Game theory

Medium.

#### PROBLEM STATEMENT\$(\$SIMPLIFIED\$)\$:

Arnab wants to play games with his friend. Now this time Arnab made an array of integers that represent the piles of chocolates. So in each turn, a player can choose only one pile and remove any number of chocolates (greater than or equal to one) from that pile. The player who cannot make a move loses the game. Arnab takes the first move. Both players play optimally.

See original problem statement here

#### For Example :

``````Input
1
5
1 2 3 4 5

Output
Arnab``````

#### OBSERVATION:

Take the xor of all the numbers given basic python programming.

If the xor comes out to be 0,then the friend wins.

If it is not zero,then Arnab wins.

#### SOLUTION:

```#include <bits/stdc++.h>
using namespace std;
void solve()
{
long long int n;
long long int x;
cin>>n;
cin>>x;
long long int result=x;
for(long long int j=1;j<n;j++)
{
cin>>x;
result=result^x;
}
if(result==0)
cout<<"Friend"<<endl;
else
cout<<"Arnab"<<endl;
}
int main()
{
int t;
cin>>t;
while(t--)
{
solve();
}

return 0;
}
```