Amr bought a new video game "Guess Your Way Out! II". The goal of the game is to find an exit from the maze that looks like a perfect binary tree of height h. The player is initially standing at the root of the tree and the exit from the tree is located at some leaf node.

Let's index all the nodes of the tree such that   The root is number 1  Each internal node i (i ≤ 2^{h} - 1 - 1) will have a left child with index = 2i and a right child with index = 2i + 1 

The level of a node is defined as 1 for a root, or 1 + level of parent of the node otherwise. The vertices of the level h are called leaves. The exit to the maze is located at some leaf node n, the player doesn't know where the exit is so he has to guess his way out! 

In the new version of the game the player is allowed to ask questions on the format "Does the ancestor(exit, i) node number belong to the range [L, R]?". Here ancestor(v, i) is the ancestor of a node v that located in the level i. The game will answer with "Yes" or "No" only. The game is designed such that it doesn't always answer correctly, and sometimes it cheats to confuse the player!.

Amr asked a lot of questions and got confused by all these answers, so he asked you to help him. Given the questions and its answers, can you identify whether the game is telling contradictory information or not? If the information is not contradictory and the exit node can be determined uniquely, output its number. If the information is not contradictory, but the exit node isn't defined uniquely, output that the number of questions is not sufficient. Otherwise output that the information is contradictory.


-----Input-----

The first line contains two integers h, q (1 ≤ h ≤ 50, 0 ≤ q ≤ 10^5), the height of the tree and the number of questions respectively.

The next q lines will contain four integers each i, L, R, ans (1 ≤ i ≤ h, 2^{i} - 1 ≤ L ≤ R ≤ 2^{i} - 1, $\text{ans} \in \{0,1 \}$), representing a question as described in the statement with its answer (ans = 1 if the answer is "Yes" and ans = 0 if the answer is "No").


-----Output-----

If the information provided by the game is contradictory output "Game cheated!" without the quotes.

Else if you can uniquely identify the exit to the maze output its index. 

Otherwise output "Data not sufficient!" without the quotes.


-----Examples-----
Input
3 1
3 4 6 0

Output
7
Input
4 3
4 10 14 1
3 6 6 0
2 3 3 1

Output
14
Input
4 2
3 4 6 1
4 12 15 1

Output
Data not sufficient!
Input
4 2
3 4 5 1
2 3 3 1

Output
Game cheated!


-----Note-----

Node u is an ancestor of node v if and only if   u is the same node as v,  u is the parent of node v,  or u is an ancestor of the parent of node v. 

In the first sample test there are 4 leaf nodes 4, 5, 6, 7. The first question says that the node isn't in the range [4, 6] so the exit is node number 7.

In the second sample test there are 8 leaf nodes. After the first question the exit is in the range [10, 14]. After the second and the third questions only node number 14 is correct. Check the picture below to fully understand.

[Image]

Source: codeforces | Difficulty: HARD
Tags: Sorting

Data structures

Implementation


Solutions:
(h, q) = list(map(int, input().split()))
d = [(2 ** h, 0), (2 ** (h - 1), 0)]
for _ in range(q):
	(i, l, r, a) = list(map(int, input().split()))
	(l, r) = (l * 2 ** (h - i), (r + 1) * 2 ** (h - i))
	d.extend([[(l, 1), (r, -1)], [(0, 1), (l, -1), (r, 1)]][a])
s = 0
l = 0
d = sorted(d)
for ((a, x), (b, _)) in zip(d, d[1:]):
	s += x
	if a != b and s == 0:
		q = a
		l += b - a
print(('Game cheated!', q, 'Data not sufficient!')[min(l, 2)])


from collections import *
(h, q) = list(map(int, input().split()))
d = defaultdict(lambda : 0)
d[2 ** h] = 0
d[2 ** (h - 1)] = 0
for _ in range(q):
	(i, l, r, a) = list(map(int, input().split()))
	(l, r) = (l * 2 ** (h - i), (r + 1) * 2 ** (h - i))
	if a:
		d[1] += 1
		d[l] -= 1
		d[r] += 1
	else:
		d[l] += 1
		d[r] -= 1
s = 0
l = 0
D = sorted(d.items())
for ((a, x), (b, _)) in zip(D, D[1:]):
	s += x
	if s == 0:
		q = a
		l += b - a
print(('Game cheated!', q, 'Data not sufficient!')[min(l, 2)])


import sys
from math import *

def minp():
	return sys.stdin.readline().strip()

def mint():
	return int(minp())

def mints():
	return map(int, minp().split())
(h, q) = mints()
a = [None] * (q * 2 + 1)
L = 1 << h - 1
R = (1 << h) - 1
j = 0
for i in range(q):
	(hh, l, r, ans) = mints()
	l = l << h - hh
	r = (r + 1 << h - hh) - 1
	if ans == 1:
		L = max(L, l)
		R = min(R, r)
	else:
		a[j] = (l, -1)
		a[j + 1] = (r + 1, 1)
		j += 2
if L > R:
	print('Game cheated!')
	exit(0)
a[j] = (1 << h, -1)
a = a[:j + 1]
a.sort()
cnt = 0
t = 1 << h - 1
ans = None
for i in a:
	if i[0] != t:
		kk = min(R + 1, i[0]) - max(t, L)
		if cnt == 0 and kk >= 1:
			if ans != None or kk > 1:
				print('Data not sufficient!')
				exit(0)
			ans = max(t, L)
		t = i[0]
	cnt -= i[1]
if ans == None:
	print('Game cheated!')
else:
	print(ans)