A, B, K = map(int, input().split())
M = min(A, B)

cnt = 0
for i in range(M):
    if A%(M-i) == 0 and B%(M-i) == 0:
        cnt += 1
        if cnt == K:
            print(M-i)
            break A, B, K = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B K M = min(A, B) M min(A, B) min A B cnt = 0 cnt 0 for i in range(M):
    if A%(M-i) == 0 and B%(M-i) == 0:
        cnt += 1
        if cnt == K:
            print(M-i)
            break i range(M) range M if A%(M-i) == 0 and B%(M-i) == 0:
        cnt += 1
        if cnt == K:
            print(M-i)
            break A%(M-i) == 0 and B%(M-i) == 0 A%(M-i) == 0 A%(M-i) A M-i M i 0 B%(M-i) == 0 B%(M-i) B M-i M i 0 cnt += 1 cnt 1 if cnt == K:
            print(M-i)
            break cnt == K cnt K print(M-i) print M-i M i break B, K = map(int, input().split()) map(int, input().split()) B cnt += 1 1 cnt A, B, K = map(int, input().split()) map(int, input().split()) A K = map(int, input().split()) map(int, input().split()) K M = min(A, B) min(A, B) M cnt = 0 0 cnt
A, B, K = map(int, input().split())
M = min(A, B)

cnt = 0
for i in range(M):
    if A%(M-i) == 0 and B%(M-i) == 0:
        cnt += 1
        if cnt == K:
            print(M-i)
            break