n, q = map(int, input().split()) def doubling(x, i): flag = False t = True if x < 0: x = abs(x) t = False for j in range(x.bit_length())[::-1]: if flag: print(3, i+1, i+1) else: flag = True if (x >> j) & 1 == 1: if t: print(1, i+1) else: print(2, i+1) if n <= 10: a = [0] * n for _ in range(q): c, s = map(int, input().split()) s -= 1 if c == 1: for j in range(s, n): a[j] += (j-s+1)**2 else: for j in range(s+1): a[j] += (s-j+1)**2 for i in range(n): doubling(a[i], i) else: a = [0] * n b = [0] * 5 for _ in range(q): c, s = map(int, input().split()) s -= 1 if c == 1: a[s] += 1 if s+1 < n: a[s] += 1 for i in range(5): if s <= i: b[i] += (i-s+1)**2 else: if s+2 < n: a[s] -= 1 if s+3 < n: a[s] -= 1 for i in range(5): if i <= s: b[i] += (s-i+1)**2 for i in range(3): for j in range(i+1, 5)[::-1]: b[j] -= b[j-1] for i in range(5): doubling(b[i], i) for i in range(5, n): doubling(a[i], i) for i in range(3)[::-1]: for j in range(i+1, n): print(3, j+1, j)