a, b, c = map(int, input().split())
i = 1
d = []
while True:
  if a % i ==0 and b % i ==0:
    d.append(i)
  if i > max(a,b):
    break
  else:
    i += 1
print(d[-c]) a, b, c = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b c i = 1 i 1 d = [] d [] while True:
  if a % i ==0 and b % i ==0:
    d.append(i)
  if i > max(a,b):
    break
  else:
    i += 1 True if a % i ==0 and b % i ==0:
    d.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 d.append(i) d.append d append i if i > max(a,b):
    break
  else:
    i += 1 i > max(a,b) i max(a,b) max a b break i += 1 i 1 print(d[-c]) print d[-c] d -c c d = [] [] d a, b, c = map(int, input().split()) map(int, input().split()) a b, c = map(int, input().split()) map(int, input().split()) b c = map(int, input().split()) map(int, input().split()) c i = 1 1 i i += 1 1 i
a, b, c = map(int, input().split())
i = 1
d = []
while True:
  if a % i ==0 and b % i ==0:
    d.append(i)
  if i > max(a,b):
    break
  else:
    i += 1
print(d[-c])