A,B,K = map(int,input().split())
li = [x for x in range(1,A+1) if A%x == 0 and B%x == 0]
print(li[-K]) A,B,K = map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B K x for x in range(1,A+1) if A%x == 0 and B%x == 0 for x in range(1,A+1) if A%x == 0 and B%x == 0 x range(1,A+1) range 1 A+1 A 1 A%x == 0 and B%x == 0 A%x == 0 A%x A x 0 B%x == 0 B%x B x 0 if A%x == 0 and B%x == 0 x li = [x for x in range(1,A+1) if A%x == 0 and B%x == 0] li [x for x in range(1,A+1) if A%x == 0 and B%x == 0] print(li[-K]) print li[-K] li -K K A,B,K = map(int,input().split()) map(int,input().split()) A K = map(int,input().split()) map(int,input().split()) K B,K = map(int,input().split()) map(int,input().split()) B li = [x for x in range(1,A+1) if A%x == 0 and B%x == 0] [x for x in range(1,A+1) if A%x == 0 and B%x == 0] li
A,B,K = map(int,input().split())
li = [x for x in range(1,A+1) if A%x == 0 and B%x == 0]
print(li[-K])
