def main():
    A, B, K = map(int, input().split())
    count = 0

    for i in range(100, 0, -1):
        if (A % i == 0) and (B % i == 0):
            count += 1
            if count == K:
                print(i)
                break
main() def main():
    A, B, K = map(int, input().split())
    count = 0

    for i in range(100, 0, -1):
        if (A % i == 0) and (B % i == 0):
            count += 1
            if count == K:
                print(i)
                break main A, B, K = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B K count = 0 count 0 for i in range(100, 0, -1):
        if (A % i == 0) and (B % i == 0):
            count += 1
            if count == K:
                print(i)
                break i range(100, 0, -1) range 100 0 -1 if (A % i == 0) and (B % i == 0):
            count += 1
            if count == K:
                print(i)
                break (A % i == 0) and (B % i == 0) A % i == 0 A % i A i 0 B % i == 0 B % i B i 0 count += 1 count 1 if count == K:
                print(i)
                break count == K count K print(i) print i break main() main def main():
    A, B, K = map(int, input().split())
    count = 0

    for i in range(100, 0, -1):
        if (A % i == 0) and (B % i == 0):
            count += 1
            if count == K:
                print(i)
                break def main():
    A, B, K = map(int, input().split())
    count = 0

    for i in range(100, 0, -1):
        if (A % i == 0) and (B % i == 0):
            count += 1
            if count == K:
                print(i)
                break main
def main():
    A, B, K = map(int, input().split())
    count = 0

    for i in range(100, 0, -1):
        if (A % i == 0) and (B % i == 0):
            count += 1
            if count == K:
                print(i)
                break
main()