A,B,K=map(int,input().split())
print([n for n in range(1,min(A,B)+1) if A%n==B%n==0][-K]) A,B,K=map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B K n for n in range(1,min(A,B)+1) if A%n==B%n==0 for n in range(1,min(A,B)+1) if A%n==B%n==0 n range(1,min(A,B)+1) range 1 min(A,B)+1 min(A,B) min A B 1 A%n==B%n==0 A%n==B%n A%n A n B%n B n 0 if A%n==B%n==0 n print([n for n in range(1,min(A,B)+1) if A%n==B%n==0][-K]) print [n for n in range(1,min(A,B)+1) if A%n==B%n==0][-K] [n for n in range(1,min(A,B)+1) if A%n==B%n==0] -K K K=map(int,input().split()) map(int,input().split()) K B,K=map(int,input().split()) map(int,input().split()) B A,B,K=map(int,input().split()) map(int,input().split()) A
A,B,K=map(int,input().split())
print([n for n in range(1,min(A,B)+1) if A%n==B%n==0][-K])