A,B,K = map(int, input().split())

D = [x for x in range(1, min(A,B)+1) if A%x == 0 and B%x == 0]

print(D[-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, min(A,B)+1) if A%x == 0 and B%x == 0 for x in range(1, min(A,B)+1) if A%x == 0 and B%x == 0 x range(1, min(A,B)+1) range 1 min(A,B)+1 min(A,B) min A B 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 D = [x for x in range(1, min(A,B)+1) if A%x == 0 and B%x == 0] D [x for x in range(1, min(A,B)+1) if A%x == 0 and B%x == 0] print(D[-K]) print D[-K] D -K K D = [x for x in range(1, min(A,B)+1) if A%x == 0 and B%x == 0] [x for x in range(1, min(A,B)+1) if A%x == 0 and B%x == 0] D B,K = map(int, input().split()) map(int, input().split()) B K = map(int, input().split()) map(int, input().split()) K A,B,K = map(int, input().split()) map(int, input().split()) A
A,B,K = map(int, input().split())

D = [x for x in range(1, min(A,B)+1) if A%x == 0 and B%x == 0]

print(D[-K])