A,B,K=map(int,input().split())
for x in range(100,0,-1):
    if A%x==0 and B%x==0:
        K-=1
    if K==0:
        print(x)
        break A,B,K=map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B K for x in range(100,0,-1):
    if A%x==0 and B%x==0:
        K-=1
    if K==0:
        print(x)
        break x range(100,0,-1) range 100 0 -1 if A%x==0 and B%x==0:
        K-=1
     A%x==0 and B%x==0 A%x==0 A%x A x 0 B%x==0 B%x B x 0 K-=1 K 1 if K==0:
        print(x)
        break K==0 K 0 print(x) print x break B,K=map(int,input().split()) map(int,input().split()) B K-=1 1 K 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())
for x in range(100,0,-1):
    if A%x==0 and B%x==0:
        K-=1
    if K==0:
        print(x)
        break
