local bxor = bit.bxor local mmi, mma = math.min, math.max local n = io.read("*n") local a, b = {}, {} for i = 1, n do a[i] = io.read("*n") end for i = 1, n do b[i] = io.read("*n") end local max = 0 for i = 1, n do max = mma(max, a[i], b[i]) end local mul = 1 while mul * 2 <= max do mul = mul * 2 end local atgt = false for i = 1, n do if mul <= a[i] then atgt = i break end end local ret = {} if not atgt then for i = 1, n do if mul <= b[i] then a[1] = bxor(a[1], b[i]) table.insert(ret, {1, 1, i}) atgt = 1 break end end end local v = a[atgt] for i = 1, n do if b[i] < mul then table.insert(ret, {2, atgt, i}) b[i] = bxor(b[i], v) end end v = b[1] for i = 1, n do if mul <= a[i] then table.insert(ret, {1, i, 1}) -- a[i] = bxor(a[i], v) end end print(#ret) for i = 1, n do print(table.concat(ret[i], " ")) end