#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
/******************************************************************************
Online C Compiler.
Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute i
*******************************************************************************/
#include<string.h>
#include <stdio.h>
#include <stdlib.h>
#include<stdbool.h>
int re = 0;
void gcd(int a, int b)
{
if (b == 0)
{
re = a;
}
else {
gcd(b, a % b);
}
}
int main()
{
bool space = false;
int n = 0, count = 0, m = 0, output = 0;
char input[100000] = { '\0' };
int num[100000] = { 0 };
char temp[100000] = { '\0' };
scanf("%d", &n);
getchar();
while (n)
{
gets_s(input);
for (int i = 0; i < strlen(input); i++)
{
if (input[i] == ' ')//&&space==false)
{
num[m] = atoi(temp);
m++;
memset(temp, '\0', sizeof(temp));
count = 0;
space = true;
}
else// if(input[i]!=' ')
{
temp[count] = input[i];
count++;
}
}
num[m] = atoi(temp);
m++;
memset(temp, '\0', sizeof(temp));
for (int i = 0; i < m - 1; i++)
{
for (int j = i + 1; j < m; j++)
{
if (num[i] != 0 && num[j] != 0)
{
gcd(num[i], num[j]);
if (re > output)
{
output = re;
}
}
}
}
printf("%d\n", output);
re = 0;
output = 0;
count = 0;
n--;
m = 0;
memset(input, '\0', sizeof(input));
memset(num, 0, sizeof(num));
}
return 0;
}