l,b = int(input().split())
l , b = input().split()
for _ in range(int(input())): l , b = int(input().split()) def hcf(l,b): if b==0: return l else: return hcf(b,l%b) print(hcf(l,b))
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)