Module _20190422

    Sub Main()

        Dim sRead As String = Console.ReadLine

        Dim iNum1 As Integer = sRead.Split(" ")(0)
        Dim iNum2 As Integer = sRead.Split(" ")(1)
        Dim iOrder As Integer = sRead.Split(" ")(2)

        Dim iMaxNum As Integer
        If iNum1 > iNum2 Then

            iMaxNum = iNum1

        Else

            iMaxNum = iNum2

        End If

        Dim iTempOrder As Integer = 0
        Dim iKotae As Integer

        For i As Integer = iMaxNum To 1 Step -1

            If iNum1 Mod i = 0 AndAlso iNum2 Mod i = 0 Then

                iTempOrder = iTempOrder + 1

            End If

            If iOrder = iTempOrder Then

                iKotae = i

                Exit For

            End If

        Next

        Console.WriteLine(iKotae)

    End Sub

End Module