A,B,K = map(int, input().split())
C =min(A,B)
list =[]
for i in range(1,C+1):
  if A%i == 0 and B%i == 0:
    list.append(i)
list = sorted(list)
ans = list[-K]
print(ans) A,B,K = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B K C =min(A,B) C min(A,B) min A B list =[] list [] for i in range(1,C+1):
  if A%i == 0 and B%i == 0:
    list.append(i) i range(1,C+1) range 1 C+1 C 1 if A%i == 0 and B%i == 0:
    list.append(i) A%i == 0 and B%i == 0 A%i == 0 A%i A i 0 B%i == 0 B%i B i 0 list.append(i) list.append list append i list = sorted(list) list sorted(list) sorted list ans = list[-K] ans list[-K] list -K K print(ans) print ans A,B,K = map(int, input().split()) map(int, input().split()) A list =[] [] list list = sorted(list) sorted(list) list K = map(int, input().split()) map(int, input().split()) K B,K = map(int, input().split()) map(int, input().split()) B C =min(A,B) min(A,B) C ans = list[-K] list[-K] ans
A,B,K = map(int, input().split())
C =min(A,B)
list =[]
for i in range(1,C+1):
  if A%i == 0 and B%i == 0:
    list.append(i)
list = sorted(list)
ans = list[-K]
print(ans)