#include using namespace std; int n,i,x,T,ans,j; int main() { scanf("%d",&T); while (T--) { scanf("%d",&n); for (i=1;i<=n;i++) scanf("%d",&x); if (n==1) printf("%d\n",x); else printf("%d\n",0); } return 0; }