from collections import defaultdict from bisect import bisect_left as bsl class RangeAddSegTree: def __init__(self, n): self.l = 1 << (n - 1).bit_length() self.t = ([0] * self.l + [0] * n + [0] * (self.l - n)) def add(self, l, r, x): l += self.l r += self.l while l < r: if l & 1: self.t[l] = x + self.t[l] l += 1 if r & 1: self.t[r - 1] = x + self.t[r - 1] r -= 1 l >>= 1 r >>= 1 def get(self, x): x += self.l res = 0 while x > 0: res = res + self.t[x] x >>= 1 return res Q = int(input()) K = [0] * Q L = [0] * Q M = [0] * Q N = [0] * Q X = [0] * Q Xs = set() for i in range(Q): K[i], L[i], M[i], N[i], X[i] = map(int, input().split()) Xs.add(X[i]) Xs = list(Xs) lx = len(Xs) Xt = defaultdict(int) for i in range(lx): Xt[Xs[i]] = i FL = [RangeAddSegTree(lx) for _ in range(2)] FR = [RangeAddSegTree(lx) for _ in range(2)] GL = [RangeAddSegTree(lx) for _ in range(2)] GR = [RangeAddSegTree(lx) for _ in range(2)] for k, l, m, n, x in zip(K, L, M, N, X): if k == 0: FL[0].add(0, lx, max(0, l)) FR[0].add(0, lx, max(0, l)) else: if k > 0: b1 = bsl(Xs, -l // k + 1) b2 = bsl(Xs, (-l + k - 1) // k) FL[0].add(b1, lx, l) FL[1].add(b1, lx, k) FR[0].add(b2, lx, l) FR[1].add(b2, lx, k) else: b1 = bsl(Xs, l // (-k) + 1) b2 = bsl(Xs, (l - k + 1) // (-k)) FL[0].add(0, b1, l) FL[1].add(0, b1, k) FR[0].add(0, b2, l) FR[1].add(0, b2, k) if m == 0: GL[0].add(0, lx, max(0, n)) GR[0].add(0, lx, max(0, n)) else: if m > 0: b1 = bsl(Xs, -n // m + 1) b2 = bsl(Xs, (-n + m - 1) // m) GL[0].add(b1, lx, n) GL[1].add(b1, lx, m) GR[0].add(b2, lx, n) GR[1].add(b2, lx, m) else: b1 = bsl(Xs, n // (-m) + 1) b2 = bsl(Xs, (n - m + 1) // (-m)) GL[0].add(0, b1, n) GL[1].add(0, b1, m) GR[0].add(0, b2, n) GR[1].add(0, b2, m) p = Xt[x] print("Yes" if FL[0].get(p) == GL[0].get(p) and FL[1].get(p) == GL[1].get(p) and FR[1].get(p) == GR[1].get(p) else "No")