F0, F1, N = [int(i) for i in input().split()] for i in range(N): F0,F1 = F1, F0^F1 print(F0)