>>> x, y = 9, 4
>>> x = x + y # 13
>>> y = x - y # 9
>>> x = x - y # 4
>>> x, y
(4,9)
>>> x, y = 9, 4 # 1001, 0100
>>> x = x ^ y # 1001 ^ 0100 = 1101(13)
>>> y = x^y # 1101 ^ 0100 = 1101(9)
>>> x = x^y # 1101^1001 = 0100(4)
>>> x, y
(4,9)
>>> x = 10
>>> y = 40
>>> (x^y)^x
40
>>> (x^y)^y
10