import sys
lines = [s.rstrip("\n") for s in sys.stdin.readlines()]
a, b, k = [int(num) for num in lines.pop(0).split(" ")]
count = 0
for n in range(min(a, b), 0, -1):
    if (a % n == 0) and (b % n == 0):
        count += 1
    if count == k:
        break
print(n) import sys sys s.rstrip("\n") for s in sys.stdin.readlines() for s in sys.stdin.readlines() s sys.stdin.readlines() sys.stdin.readlines sys.stdin sys stdin readlines for s in sys.stdin.readlines() s.rstrip("\n") s.rstrip s rstrip "\n" lines = [s.rstrip("\n") for s in sys.stdin.readlines()] lines [s.rstrip("\n") for s in sys.stdin.readlines()] int(num) for num in lines.pop(0).split(" ") for num in lines.pop(0).split(" ") num lines.pop(0).split(" ") lines.pop(0).split lines.pop(0) lines.pop lines pop 0 split " " for num in lines.pop(0).split(" ") int(num) int num a, b, k = [int(num) for num in lines.pop(0).split(" ")] a [int(num) for num in lines.pop(0).split(" ")] b k count = 0 count 0 for n in range(min(a, b), 0, -1):
    if (a % n == 0) and (b % n == 0):
        count += 1
    if count == k:
        break n range(min(a, b), 0, -1) range min(a, b) min a b 0 -1 if (a % n == 0) and (b % n == 0):
        count += 1
     (a % n == 0) and (b % n == 0) a % n == 0 a % n a n 0 b % n == 0 b % n b n 0 count += 1 count 1 if count == k:
        break count == k count k break print(n) print n a, b, k = [int(num) for num in lines.pop(0).split(" ")] [int(num) for num in lines.pop(0).split(" ")] a count = 0 0 count k = [int(num) for num in lines.pop(0).split(" ")] [int(num) for num in lines.pop(0).split(" ")] k lines = [s.rstrip("\n") for s in sys.stdin.readlines()] [s.rstrip("\n") for s in sys.stdin.readlines()] lines b, k = [int(num) for num in lines.pop(0).split(" ")] [int(num) for num in lines.pop(0).split(" ")] b count += 1 1 count
import sys
lines = [s.rstrip("\n") for s in sys.stdin.readlines()]
a, b, k = [int(num) for num in lines.pop(0).split(" ")]
count = 0
for n in range(min(a, b), 0, -1):
    if (a % n == 0) and (b % n == 0):
        count += 1
    if count == k:
        break
print(n)
