A,B,K = map(int,input().split())
ct = 0
for i in range(101,0,-1):
    if (A % i == 0) & (B % i == 0):
        ct += 1
        if ct == K:
            break

print(i) A,B,K = map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B K ct = 0 ct 0 for i in range(101,0,-1):
    if (A % i == 0) & (B % i == 0):
        ct += 1
        if ct == K:
            break i range(101,0,-1) range 101 0 -1 if (A % i == 0) & (B % i == 0):
        ct += 1
        if ct == K:
            break (A % i == 0) & (B % i == 0) A % i == 0 A % i A i 0 B % i == 0 B % i B i 0 ct += 1 ct 1 if ct == K:
            break ct == K ct K break print(i) print i B,K = map(int,input().split()) map(int,input().split()) B A,B,K = map(int,input().split()) map(int,input().split()) A ct += 1 1 ct ct = 0 0 ct K = map(int,input().split()) map(int,input().split()) K
A,B,K = map(int,input().split())
ct = 0
for i in range(101,0,-1):
    if (A % i == 0) & (B % i == 0):
        ct += 1
        if ct == K:
            break

print(i)