import sys A, B, C = map(int, sys.stdin.readline().split()) A1 = A B1 = B C1 = C while A != 0 and B != 0: if A > B: A %= B else: B %= A print(A + B, end = ' ') while A1 != 0 and C != 0: if A1 > C: A1 %= C else: C %= A1 print(A1 + C, end = ' ') while B1 != 0 and C1 != 0: if B1 > C1: B1 %= C1 else: C1 %= B1 print(B1 + C1)