import java.util.Scanner;
public class two_number
{
public static void main(String args[])
{
long ali,bob,n,res,max,min,i,j,t;
Scanner sc=new Scanner(System.in);
t=sc.nextLong();
for(j=0;j<=t;j++)
{
ali=sc.nextLong();
bob=sc.nextLong();
n=sc.nextLong();
for(i=2;i<=n+1;i++)
{
if(i%2==0)
{
ali=ali*2;
}
else
{
bob=bob*2;
}
}
if(ali>bob)
{
max=ali;
min=bob;
}
else
{
max=bob;
min=ali;
}
res=max/min;
System.out.println(res);
}
}
}