a,b,k = map(int,input().split())
minnum = min(a,b)
maxnum = max(a,b)
lis = []
for mi in reversed(range(1,minnum+1)):
  if minnum % mi == 0 and maxnum % mi == 0:
    lis.append(mi)

print(lis[k-1]) a,b,k = map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b k minnum = min(a,b) minnum min(a,b) min a b maxnum = max(a,b) maxnum max(a,b) max a b lis = [] lis [] for mi in reversed(range(1,minnum+1)):
  if minnum % mi == 0 and maxnum % mi == 0:
    lis.append(mi) mi reversed(range(1,minnum+1)) reversed range(1,minnum+1) range 1 minnum+1 minnum 1 if minnum % mi == 0 and maxnum % mi == 0:
    lis.append(mi) minnum % mi == 0 and maxnum % mi == 0 minnum % mi == 0 minnum % mi minnum mi 0 maxnum % mi == 0 maxnum % mi maxnum mi 0 lis.append(mi) lis.append lis append mi print(lis[k-1]) print lis[k-1] lis k-1 k 1 lis = [] [] lis b,k = map(int,input().split()) map(int,input().split()) b minnum = min(a,b) min(a,b) minnum a,b,k = map(int,input().split()) map(int,input().split()) a maxnum = max(a,b) max(a,b) maxnum k = map(int,input().split()) map(int,input().split()) k
a,b,k = map(int,input().split())
minnum = min(a,b)
maxnum = max(a,b)
lis = []
for mi in reversed(range(1,minnum+1)):
  if minnum % mi == 0 and maxnum % mi == 0:
    lis.append(mi)

print(lis[k-1])