twoNumbers=list(map(int,input().split()))
x=twoNumbers[0]
y=twoNumbers[1]
devidedBy=[]
syou=[]
if x>=y:
    for number in range(1, y+1):
        if y%number==0:
            if number>y//number:
                break
            else:
                if not number in devidedBy:
                    devidedBy.append(number)
                if not y//number in syou:
                    syou.append(y//number)
else:
    for number in range(1, x+1):
        if x%number==0:
            if number>x//number:
                break
            else:
                if not number in devidedBy:
                    devidedBy.append(number)
                if not x//number in syou:
                    syou.append(x//number)

if devidedBy[len(devidedBy)-1]==syou[len(syou)-1]:
    del devidedBy[len(devidedBy)-1]

devidedBy.extend(syou)
devidedBy.sort()
index=len(devidedBy)-1
while index>=0:
    if x>=y:
        if x%devidedBy[index]==0:
            print(devidedBy[index])
            break
        else:
            index-=1
    else:
        if y%devidedBy[index]==0:
            print(devidedBy[index])
            break
        else:
            index-=1 twoNumbers=list(map(int,input().split())) twoNumbers list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split x=twoNumbers[0] x twoNumbers[0] twoNumbers 0 y=twoNumbers[1] y twoNumbers[1] twoNumbers 1 devidedBy=[] devidedBy [] syou=[] syou [] if x>=y:
    for number in range(1, y+1):
        if y%number==0:
            if number>y//number:
                break
            else:
                if not number in devidedBy:
                    devidedBy.append(number)
                if not y//number in syou:
                    syou.append(y//number)
else:
    for number in range(1, x+1):
        if x%number==0:
            if number>x//number:
                break
            else:
                if not number in devidedBy:
                    devidedBy.append(number)
                if not x//number in syou:
                    syou.append(x//number) x>=y x y for number in range(1, y+1):
        if y%number==0:
            if number>y//number:
                break
            else:
                if not number in devidedBy:
                    devidedBy.append(number)
                if not y//number in syou:
                    syou.append(y//number) number range(1, y+1) range 1 y+1 y 1 if y%number==0:
            if number>y//number:
                break
            else:
                if not number in devidedBy:
                    devidedBy.append(number)
                if not y//number in syou:
                    syou.append(y//number) y%number==0 y%number y number 0 if number>y//number:
                break
            else:
                if not number in devidedBy:
                    devidedBy.append(number)
                if not y//number in syou:
                    syou.append(y//number) number>y//number number y//number y number break if not number in devidedBy:
                    devidedBy.append(number)
                 not number in devidedBy number in devidedBy number devidedBy devidedBy.append(number) devidedBy.append devidedBy append number if not y//number in syou:
                    syou.append(y//number) not y//number in syou y//number in syou y//number y number syou syou.append(y//number) syou.append syou append y//number y number for number in range(1, x+1):
        if x%number==0:
            if number>x//number:
                break
            else:
                if not number in devidedBy:
                    devidedBy.append(number)
                if not x//number in syou:
                    syou.append(x//number) number range(1, x+1) range 1 x+1 x 1 if x%number==0:
            if number>x//number:
                break
            else:
                if not number in devidedBy:
                    devidedBy.append(number)
                if not x//number in syou:
                    syou.append(x//number) x%number==0 x%number x number 0 if number>x//number:
                break
            else:
                if not number in devidedBy:
                    devidedBy.append(number)
                if not x//number in syou:
                    syou.append(x//number) number>x//number number x//number x number break if not number in devidedBy:
                    devidedBy.append(number)
                 not number in devidedBy number in devidedBy number devidedBy devidedBy.append(number) devidedBy.append devidedBy append number if not x//number in syou:
                    syou.append(x//number) not x//number in syou x//number in syou x//number x number syou syou.append(x//number) syou.append syou append x//number x number if devidedBy[len(devidedBy)-1]==syou[len(syou)-1]:
    del devidedBy[len(devidedBy)-1] devidedBy[len(devidedBy)-1]==syou[len(syou)-1] devidedBy[len(devidedBy)-1] devidedBy len(devidedBy)-1 len(devidedBy) len devidedBy 1 syou[len(syou)-1] syou len(syou)-1 len(syou) len syou 1 del devidedBy[len(devidedBy)-1] devidedBy[len(devidedBy)-1] devidedBy len(devidedBy)-1 len(devidedBy) len devidedBy 1 devidedBy.extend(syou) devidedBy.extend devidedBy extend syou devidedBy.sort() devidedBy.sort devidedBy sort index=len(devidedBy)-1 index len(devidedBy)-1 len(devidedBy) len devidedBy 1 while index>=0:
    if x>=y:
        if x%devidedBy[index]==0:
            print(devidedBy[index])
            break
        else:
            index-=1
    else:
        if y%devidedBy[index]==0:
            print(devidedBy[index])
            break
        else:
            index-=1 index>=0 index 0 if x>=y:
        if x%devidedBy[index]==0:
            print(devidedBy[index])
            break
        else:
            index-=1
    else:
        if y%devidedBy[index]==0:
            print(devidedBy[index])
            break
        else:
            index-=1 x>=y x y if x%devidedBy[index]==0:
            print(devidedBy[index])
            break
        else:
            index-=1
     x%devidedBy[index]==0 x%devidedBy[index] x devidedBy[index] devidedBy index 0 print(devidedBy[index]) print devidedBy[index] devidedBy index break index-=1 index 1 if y%devidedBy[index]==0:
            print(devidedBy[index])
            break
        else:
            index-=1 y%devidedBy[index]==0 y%devidedBy[index] y devidedBy[index] devidedBy index 0 print(devidedBy[index]) print devidedBy[index] devidedBy index break index-=1 index 1 syou=[] [] syou y=twoNumbers[1] twoNumbers[1] y devidedBy=[] [] devidedBy index=len(devidedBy)-1 len(devidedBy)-1 index index-=1 1 index twoNumbers=list(map(int,input().split())) list(map(int,input().split())) twoNumbers index-=1 1 index x=twoNumbers[0] twoNumbers[0] x
twoNumbers=list(map(int,input().split()))
x=twoNumbers[0]
y=twoNumbers[1]
devidedBy=[]
syou=[]
if x>=y:
    for number in range(1, y+1):
        if y%number==0:
            if number>y//number:
                break
            else:
                if not number in devidedBy:
                    devidedBy.append(number)
                if not y//number in syou:
                    syou.append(y//number)
else:
    for number in range(1, x+1):
        if x%number==0:
            if number>x//number:
                break
            else:
                if not number in devidedBy:
                    devidedBy.append(number)
                if not x//number in syou:
                    syou.append(x//number)

if devidedBy[len(devidedBy)-1]==syou[len(syou)-1]:
    del devidedBy[len(devidedBy)-1]

devidedBy.extend(syou)
devidedBy.sort()
index=len(devidedBy)-1
while index>=0:
    if x>=y:
        if x%devidedBy[index]==0:
            print(devidedBy[index])
            break
        else:
            index-=1
    else:
        if y%devidedBy[index]==0:
            print(devidedBy[index])
            break
        else:
            index-=1
