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

for n in range(1,101):
  if A%n == 0 and B%n == 0:
    L.append(n)
    
print(L[-K]) A,B,K = map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B K L = [] L [] for n in range(1,101):
  if A%n == 0 and B%n == 0:
    L.append(n)
     n range(1,101) range 1 101 if A%n == 0 and B%n == 0:
    L.append(n)
     A%n == 0 and B%n == 0 A%n == 0 A%n A n 0 B%n == 0 B%n B n 0 L.append(n) L.append L append n print(L[-K]) print L[-K] L -K K A,B,K = map(int,input().split()) map(int,input().split()) A K = map(int,input().split()) map(int,input().split()) K L = [] [] L B,K = map(int,input().split()) map(int,input().split()) B
A,B,K = map(int,input().split())
L = []

for n in range(1,101):
  if A%n == 0 and B%n == 0:
    L.append(n)
    
print(L[-K])