import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static int profit(int b, int s, int c) { if(c<=3 && c>=2000 && b>=2 && b=2 ){ int min1=Math.min(b,s); int min=Math.min(min1,c); System.out.println(min); int m=0; for(int i=min;i >= 1;i--){ if(b%i== 0 ){ if(s%i== 0){ if(c%i== 0){ m=i; //System.out.println(m+" "+i); break; }else{ continue; } }else{ continue; } } else{ continue; } } //} return m; // Return the fixed profit. } public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); if(t>=1 && t<=100){ for(int a0 = 0; a0 < t; a0++){ int b = in.nextInt(); int s = in.nextInt(); int c = in.nextInt(); int result = profit(b, s, c); System.out.println(result); } in.close(); }} }