Bob just learned about bitwise operators. Since Alice is an expert, she decided to play a game, she will give a number $x$ to Bob and will ask some questions:
There will be 4 different kinds of queries:-
- 
Alice gives an integer $i$ and Bob has to report the status of the $i^{th}$ bit in $x$, the answer is $"ON"$ if it is on else $"OFF"$.
- 
Alice gives an integer $i$ and Bob has to turn on the $i^{th}$ bit in $x$.
- 
Alice gives an integer $i$ and Bob has to turn off the $i^{th}$ bit in $x$.
- 
Alice gives two integers $p$ and $q$ and in the binary representation of $x$ Bob has to swap the $p^{th}$ and the $q^{th}$ bits.
The value of $x$ changes after any update operation.
positions $i$, $p$, and $q$ are always counted from the right or from the least significant bit.
If anyone of $i$, $p$, or $q$ is greater than the number of bits in the binary representation of $x$, consider $0$ at that position.

-----Input:-----
- First-line will contain $T$, the number of test cases. Then the test cases follow. 
- the first line of each test case contains two space-separated integers $x, Q$.
- $2Q$ lines follow.
- first line is an integer, the query type.
- for each query of type 1 to 3, there will be the integer $i$
- for the query of type 4, there will be two space-separated integers, the integers $p, q$

-----Output:-----
For the queries of the first kind, print $"ON"$ or $"OFF"$.

-----Constraints-----
- $1 \leq T \leq 10^3$
- $1 \leq x \leq 10^9$
- $1 \leq Q \leq 10^3$
- $1 \leq i,p,q \leq 30$

-----Sample Input-----
1
2 2
2 
1
1 
1

-----Sample Output:-----
ON

-----EXPLANATION:-----
the binary representation of 2 is 10
for query 1, we just have to update x to 11 (or 3 in decimal).
for the next query, x is now 3 or 11 in binary so the answer is ON.

Difficulty: UNKNOWN_DIFFICULTY

Solutions:
t = int(input())
while t > 0:
	(n, q) = list(map(int, input().split()))
	blst = [0]
	for i in range(1, 65):
		blst.append(0)
	i = 1
	while n > 0:
		if n % 2:
			blst[i] = 1
		n //= 2
		i += 1
	while q > 0:
		n = int(input())
		if n == 1:
			p = int(input())
			if blst[p]:
				print('ON')
			else:
				print('OFF')
		elif n == 2:
			p = int(input())
			if blst[p] == 0:
				blst[p] = 1
		elif n == 3:
			p = int(input())
			if blst[p] == 1:
				blst[p] = 0
		else:
			(p, r) = list(map(int, input().split()))
			if blst[p] != blst[r]:
				blst[p] += 1
				blst[p] %= 2
				blst[r] += 1
				blst[r] %= 2
		q -= 1
	t -= 1


for _ in range(int(input())):
	(N, X) = list(map(int, input().split()))
	string = []
	while N // 2 != 0:
		string.append(N % 2)
		N = N // 2
	string.append(1)
	for _ in range(X):
		p = int(input())
		if p == 1:
			i = int(input())
			if i - 1 < len(string):
				if string[i - 1] == 1:
					print('ON')
					continue
				else:
					print('OFF')
					continue
			else:
				print('OFF')
				continue
		elif p == 2:
			i = int(input())
			if i > len(string):
				x = i - len(string)
				for _ in range(x):
					string.append(0)
				string[len(string) - 1] = 1
				continue
			else:
				string[i - 1] = 1
				continue
		elif p == 3:
			i = int(input())
			if i > len(string):
				x = i - len(string)
				for _ in range(x):
					string.append(0)
				continue
			else:
				string[i - 1] = 0
				continue
		else:
			(j, k) = list(map(int, input().split()))
			if j > len(string) or k > len(string):
				x = max(j, k) - len(string)
				for _ in range(x):
					string.append(0)
				(string[j - 1], string[k - 1]) = (string[k - 1], string[j - 1])
				continue
			else:
				(string[j - 1], string[k - 1]) = (string[k - 1], string[j - 1])


t = int(input())
while t:
	t -= 1
	(b, k) = list(map(int, input().split()))
	x = bin(b)[2:]
	n = len(x)
	for j in range(k):
		qu = int(input())
		if 1 <= qu <= 3:
			i = int(input())
			if qu == 1:
				if i <= n:
					r = n - i + 1
					if x[r - 1] == '0':
						print('OFF')
					else:
						print('ON')
				else:
					print('OFF')
			elif qu == 2:
				if i <= n:
					r = n - i + 1
					x = x[0:r - 1] + '1' + x[r:n]
				else:
					x = '1' + (i - n - 1) * '0' + x
					n = i
			elif qu == 3:
				if i <= n:
					r = n - i + 1
					x = x[0:r - 1] + '0' + x[r:n]
		else:
			(p, q) = list(map(int, input().split()))
			if p <= n and q <= n:
				r1 = n - p + 1
				r2 = n - q + 1
				t1 = x[r1 - 1]
				t2 = x[r2 - 1]
				if x[r2 - 1] != t1:
					x = x[0:r2 - 1] + t1 + x[r2:n]
				if x[r1 - 1] != t2:
					x = x[0:r1 - 1] + t2 + x[r1:n]
			elif p <= n:
				r1 = n - p + 1
				p1 = x[r1 - 1]
				x = x[0:r1 - 1] + '0' + x[r1:n]
				if p1 == '1':
					x = '1' + (q - n - 1) * '0' + x
					n = q
			elif q <= n:
				r2 = n - q + 1
				p2 = x[r2 - 1]
				x = x[0:r2 - 1] + '0' + x[r2:n]
				if p2 == '1':
					x = '1' + (p - n - 1) * '0' + x
					n = p


n = int(input())
for i in range(0, n):
	o = input().rstrip().split(' ')
	q = int(o[1])
	x = int(o[0])
	t = list(str(bin(x)))
	del t[0]
	del t[0]
	while len(t) < 30:
		t.insert(0, '0')
	t.reverse()
	for j in range(0, q):
		o = int(input())
		if o == 1:
			p = int(input())
			if int(t[p - 1]) == 0:
				print('OFF')
			else:
				print('ON')
		elif o == 2:
			p = int(input())
			t[p - 1] = 1
		elif o == 3:
			p = int(input())
			t[p - 1] = 0
		else:
			E = input().rstrip().split(' ')
			A = int(E[0])
			B = int(E[1])
			temp = t[A - 1]
			t[A - 1] = t[B - 1]
			t[B - 1] = temp


def make_31(string):
	if len(string) < 31:
		string = (31 - len(string)) * '0' + string
	return string
for _ in range(int(input())):
	(x, Q) = list(map(int, input().split()))
	b = make_31(bin(x)[2:])
	b = list(b.strip())
	for qqq in range(Q):
		query = int(input())
		if query == 1:
			p = int(input())
			print('ON' if b[31 - p] == '1' else 'OFF')
		elif query == 2:
			p = int(input())
			b[31 - p] = '1'
		elif query == 3:
			p = int(input())
			b[31 - p] = '0'
		else:
			(p, q) = list(map(int, input().split()))
			temp = b[31 - q]
			b[31 - q] = b[31 - p]
			b[31 - p] = temp


for _ in range(int(input())):
	a = [0 for i in range(32)]
	(m, n) = list(map(int, input().split()))
	k = 0
	while m != 0:
		a[k] = m % 2
		k += 1
		m = m // 2
	for i in range(n):
		c = int(input())
		if c == 4:
			(p, q) = list(map(int, input().split()))
			(a[p - 1], a[q - 1]) = (a[q - 1], a[p - 1])
		if c == 1:
			d = int(input())
			if a[d - 1] == 1:
				print('ON')
			else:
				print('OFF')
		if c == 2:
			d = int(input())
			a[d - 1] = 1
		if c == 3:
			d = int(input())
			a[d - 1] = 0


for _ in range(int(input())):
	(x, q) = list(map(int, input().split()))
	for _ in range(q):
		f = int(input())
		if f == 1:
			i = int(input()) - 1
			if x >> i & 1:
				print('ON')
			else:
				print('OFF')
		elif f == 2:
			i = int(input()) - 1
			if not x >> i & 1:
				x ^= 1 << i
		elif f == 3:
			i = int(input()) - 1
			if x >> i & 1:
				x ^= 1 << i
		elif f == 4:
			(p, q) = list(map(int, input().split()))
			p -= 1
			q -= 1
			ox = x
			x -= (ox >> p & 1) * (1 << p)
			x += (ox >> q & 1) * (1 << p)
			x -= (ox >> q & 1) * (1 << q)
			x += (ox >> p & 1) * (1 << q)


from sys import stdin, stdout, maxsize
from math import sqrt, log, factorial, gcd
from collections import defaultdict as D
from bisect import insort
for _ in range(int(input())):
	(x, q) = map(int, input().split())
	b = list(bin(x))
	b = b[2:]
	b = b[::-1]
	b.insert(0, '0')
	d = D(lambda : 0)
	l = len(b)
	for i in range(l):
		d[i] = b[i]
	for i in range(q):
		t = int(input())
		if t <= 3:
			x = int(input())
			if t == 1:
				if d[x] == '1':
					print('ON')
				else:
					print('OFF')
			elif t == 2:
				d[x] = '1'
			else:
				d[x] = '0'
		else:
			(p, q) = map(int, input().split())
			(d[p], d[q]) = (d[q], d[p])