a, b, k = map(int, input().split())
chk = 0
i = 100
while i > 0:
    if a%i==0 and b%i==0:
        chk += 1
        if chk == k:
            print(i)
            exit()
        else:
            pass
    i -= 1 a, b, k = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b k chk = 0 chk 0 i = 100 i 100 while i > 0:
    if a%i==0 and b%i==0:
        chk += 1
        if chk == k:
            print(i)
            exit()
        else:
            pass
    i -= 1 i > 0 i 0 if a%i==0 and b%i==0:
        chk += 1
        if chk == k:
            print(i)
            exit()
        else:
            pass
     a%i==0 and b%i==0 a%i==0 a%i a i 0 b%i==0 b%i b i 0 chk += 1 chk 1 if chk == k:
            print(i)
            exit()
        else:
            pass
     chk == k chk k print(i) print i exit() exit i -= 1 i 1 chk = 0 0 chk b, k = map(int, input().split()) map(int, input().split()) b a, b, k = map(int, input().split()) map(int, input().split()) a i -= 1 1 i i = 100 100 i k = map(int, input().split()) map(int, input().split()) k chk += 1 1 chk
a, b, k = map(int, input().split())
chk = 0
i = 100
while i > 0:
    if a%i==0 and b%i==0:
        chk += 1
        if chk == k:
            print(i)
            exit()
        else:
            pass
    i -= 1