def make_divisors(n):
    if n==1:
        divisors=[1]
        return divisors
    else:
        divisors=[]
        for i in range(1,n):
            if i*i>n:
                break
            if n%i==0:
                divisors.append(i)
                if i!=n//i:
                    divisors.append(n//i)

        divisors.sort(reverse=True)
        return divisors

from sys import stdin
from math import gcd
def main():
    #入力
    readline=stdin.readline
    a,b,k=map(int,readline().split())

    c=gcd(a,b)
    li=make_divisors(c)

    print(li[k-1])

if __name__=="__main__":
    main() def make_divisors(n):
    if n==1:
        divisors=[1]
        return divisors
    else:
        divisors=[]
        for i in range(1,n):
            if i*i>n:
                break
            if n%i==0:
                divisors.append(i)
                if i!=n//i:
                    divisors.append(n//i)

        divisors.sort(reverse=True)
        return divisors make_divisors if n==1:
        divisors=[1]
        return divisors
    else:
        divisors=[]
        for i in range(1,n):
            if i*i>n:
                break
            if n%i==0:
                divisors.append(i)
                if i!=n//i:
                    divisors.append(n//i)

        divisors.sort(reverse=True)
        return divisors n==1 n 1 divisors=[1] divisors [1] 1 return divisors divisors divisors=[] divisors [] for i in range(1,n):
            if i*i>n:
                break
            if n%i==0:
                divisors.append(i)
                if i!=n//i:
                    divisors.append(n//i)

         i range(1,n) range 1 n if i*i>n:
                break
             i*i>n i*i i i n break if n%i==0:
                divisors.append(i)
                if i!=n//i:
                    divisors.append(n//i)

         n%i==0 n%i n i 0 divisors.append(i) divisors.append divisors append i if i!=n//i:
                    divisors.append(n//i)

         i!=n//i i n//i n i divisors.append(n//i) divisors.append divisors append n//i n i divisors.sort(reverse=True) divisors.sort divisors sort reverse=True reverse True return divisors divisors n n from sys import stdin from math import gcd def main():
    #入力
    readline=stdin.readline
    a,b,k=map(int,readline().split())

    c=gcd(a,b)
    li=make_divisors(c)

    print(li[k-1]) main readline=stdin.readline readline stdin.readline stdin readline a,b,k=map(int,readline().split()) a map(int,readline().split()) map int readline().split() ().split () readline split b k c=gcd(a,b) c gcd(a,b) gcd a b li=make_divisors(c) li make_divisors(c) make_divisors c print(li[k-1]) print li[k-1] li k-1 k 1 if __name__=="__main__":
    main() __name__=="__main__" __name__ "__main__" main() main def make_divisors(n):
    if n==1:
        divisors=[1]
        return divisors
    else:
        divisors=[]
        for i in range(1,n):
            if i*i>n:
                break
            if n%i==0:
                divisors.append(i)
                if i!=n//i:
                    divisors.append(n//i)

        divisors.sort(reverse=True)
        return divisors def make_divisors(n):
    if n==1:
        divisors=[1]
        return divisors
    else:
        divisors=[]
        for i in range(1,n):
            if i*i>n:
                break
            if n%i==0:
                divisors.append(i)
                if i!=n//i:
                    divisors.append(n//i)

        divisors.sort(reverse=True)
        return divisors make_divisors def main():
    #入力
    readline=stdin.readline
    a,b,k=map(int,readline().split())

    c=gcd(a,b)
    li=make_divisors(c)

    print(li[k-1]) def main():
    #入力
    readline=stdin.readline
    a,b,k=map(int,readline().split())

    c=gcd(a,b)
    li=make_divisors(c)

    print(li[k-1]) main
def make_divisors(n):
    if n==1:
        divisors=[1]
        return divisors
    else:
        divisors=[]
        for i in range(1,n):
            if i*i>n:
                break
            if n%i==0:
                divisors.append(i)
                if i!=n//i:
                    divisors.append(n//i)

        divisors.sort(reverse=True)
        return divisors

from sys import stdin
from math import gcd
def main():
    #入力
    readline=stdin.readline
    a,b,k=map(int,readline().split())

    c=gcd(a,b)
    li=make_divisors(c)

    print(li[k-1])

if __name__=="__main__":
    main()