import math def compute_snf(A11, A12, A21, A22): det = abs(A11 * A22 - A12 * A21) g = math.gcd(math.gcd(A11, A12), math.gcd(A21, A22)) if det==0:return print(g,0) D1 = g D2 = det // D1 print(D1, D2) lst = [list(map(int, input().split())) for _ in range(2)] A11, A12, A21, A22 = lst[0][0],lst[0][1],lst[1][0],lst[1][1] compute_snf(A11, A12, A21, A22)