a,b,k=map(int,input().split())

def cf(x1,x2):
    cf=[]
    for i in range(2,min(x1,x2)+1):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf

lst=cf(a,b)
lst.insert(0,1)

print(lst[-k]) a,b,k=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b k def cf(x1,x2):
    cf=[]
    for i in range(2,min(x1,x2)+1):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf cf cf=[] cf [] for i in range(2,min(x1,x2)+1):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
     i range(2,min(x1,x2)+1) range 2 min(x1,x2)+1 min(x1,x2) min x1 x2 1 if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
     x1 % i == 0 and x2 % i == 0 x1 % i == 0 x1 % i x1 i 0 x2 % i == 0 x2 % i x2 i 0 cf.append(i) cf.append cf append i return cf cf x1 x1 x2 x2 lst=cf(a,b) lst cf(a,b) cf a b lst.insert(0,1) lst.insert lst insert 0 1 print(lst[-k]) print lst[-k] lst -k k lst=cf(a,b) cf(a,b) lst a,b,k=map(int,input().split()) map(int,input().split()) a k=map(int,input().split()) map(int,input().split()) k def cf(x1,x2):
    cf=[]
    for i in range(2,min(x1,x2)+1):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf def cf(x1,x2):
    cf=[]
    for i in range(2,min(x1,x2)+1):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf cf b,k=map(int,input().split()) map(int,input().split()) b
a,b,k=map(int,input().split())

def cf(x1,x2):
    cf=[]
    for i in range(2,min(x1,x2)+1):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf

lst=cf(a,b)
lst.insert(0,1)

print(lst[-k])