Time Limit: 8 sec / Memory Limit: 64 MB





Example

Input

2
4 2
4 0.4000000
3 0.5000000
4 1
5 0.3333333
5 3
5 0.7777777
4 0.1111111
2 0.0001111


Output

YES
t = input()
q = [0]*(t + 1)
for i in range(t + 1):
	n,m = map(int,raw_input().split())
	vr = [map(float,raw_input().split()) for x in range(m)]
	q[i] = sum([v*r for v,r in vr])/sum([r for v,r in vr]) 
print "YES" if max(q[:-1]) - q[-1] > 0.0000001 else "NO"