#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;
const int maxn=1000009;
long long g[maxn];
int t,n;
long long gcd(long long a,long long b)
{
return b ? gcd(b,a%b):a;
}
int main()
{
scanf("%d",&t);
while(t--)
{
memset(g,0,sizeof(g));
scanf("%d",&n);
for(int i=0; i<n; i++)
scanf("%lld",&g[i]);
long long temp=g[0];//注意temp=g[0]
for(int i=0; i<n; i++)
{
long long a=temp;
long long b=g[i];
temp=gcd(a,b);
}
printf("%lld\n",temp);
}
return 0;
}
#include <string.h>
#include <algorithm>
using namespace std;
const int maxn=1000009;
long long g[maxn];
int t,n;
long long gcd(long long a,long long b)
{
return b ? gcd(b,a%b):a;
}
int main()
{
scanf("%d",&t);
while(t--)
{
memset(g,0,sizeof(g));
scanf("%d",&n);
for(int i=0; i<n; i++)
scanf("%lld",&g[i]);
long long temp=g[0];//注意temp=g[0]
for(int i=0; i<n; i++)
{
long long a=temp;
long long b=g[i];
temp=gcd(a,b);
}
printf("%lld\n",temp);
}
return 0;
}