import sys
input = sys.stdin.readline
hell=1000000007

def meowmeow321():
    n,q=map(int,input().split())
    cnt=0
    mark1 = [0]*(n+5)
    mark2 = [0]*(n+5)
    for i in range(q):
        r,c = map(int,input().split())
        if r==1:
            if mark1[c]:
                cnt-=mark2[c]
                cnt-=mark2[c+1]
                cnt-=mark2[c-1]
            else:
                cnt+=mark2[c]
                cnt+=mark2[c+1]
                cnt+=mark2[c-1]
            mark1[c]=1-mark1[c]
        else:
            if mark2[c]:
                cnt-=mark1[c]
                cnt-=mark1[c+1]
                cnt-=mark1[c-1]
            else:
                cnt+=mark1[c]
                cnt+=mark1[c+1]
                cnt+=mark1[c-1]
            mark2[c]=1-mark2[c]
        if cnt>0:
            print("Yes")
        else:
            print("No")
#t=int(input())
t=1
for i in range(t):
    meowmeow321()


import sys
input = sys.stdin.readline
hell=1000000007

def meowmeow321():
    n,q=map(int,input().split())
    cnt=0
    mark1 = [0]*(n+5)
    mark2 = [0]*(n+5)
    for i in range(q):
        r,c = map(int,input().split())
        if r==1:
            if mark1[c]:
                cnt-=mark2[c]
                cnt-=mark2[c+1]
                cnt-=mark2[c-1]
            else:
                cnt+=mark2[c]
                cnt+=mark2[c+1]
                cnt+=mark2[c-1]
            mark1[c]=1-mark1[c]
        else:
            if mark2[c]:
                cnt-=mark1[c]
                cnt-=mark1[c+1]
                cnt-=mark1[c-1]
            else:
                cnt+=mark1[c]
                cnt+=mark1[c+1]
                cnt+=mark1[c-1]
            mark2[c]=1-mark2[c]
        if cnt==0:
            print("Yes")
        else:
            print("No")
#t=int(input())
t=1
for i in range(t):
    meowmeow321()


n,q=map(int,input().split())
maze=[[0]*n,[0]*n]
barrier=0
for _ in range(q):
    ri,ci=map(int,input().split())
    ri-=1;ci-=1
    if maze[ri][ci]==0:
        maze[ri][ci]=1
        if ri==0:
            barrier+=maze[ri+1][ci]
            if ci-1 >= 0: barrier += maze[ri+1][ci-1]
            if ci+1<n:barrier+=maze[ri+1][ci+1]
        elif ri==1:
            barrier+=maze[ri-1][ci]
            if ci - 1 >= 0: barrier += maze[ri - 1][ci - 1]
            if ci + 1 < n: barrier += maze[ri - 1][ci + 1]
    else:
        maze[ri][ci]=0
        if ri==0:
            barrier-=maze[ri+1][ci]
            if ci-1 >= 0: barrier -= maze[ri+1][ci-1]
            if ci+1<n:barrier-=maze[ri+1][ci+1]
        elif ri==1:
            barrier-=maze[ri-1][ci]
            if ci - 1 >= 0: barrier -= maze[ri - 1][ci - 1]
            if ci + 1 < n: barrier -= maze[ri - 1][ci + 1]
    if barrier>0:print("No")
    else:print("Yes")


n,q=map(int,input().split())
#full=dict()
full=[False for i in range(2*n)]
full2=0
v2n1=2*n
for i in range(q):
    tap=list(map(int,input().split()))
    #if tap[0]==1:
    #    use=tap[1]
    #else:
    #    use=-tap[1]
    use=tap[1]-1
    half=tap[0]

    if half==1:
        a1,a2,a3=use+n-1,use+n,use+n+1
    else:
        a1,a2,a3=use-1,use,use+1
        use=use+n
    if full[use]:
        if a1>-1 and full[a1]:
            full2-=1
        if full[a2]:
            full2-=1
        if a3<v2n1 and full[a3]:
            full2-=1
        full[use]=False
    else:
        if a1>-1 and full[a1]:
            full2+=1
        if full[a2]:
            full2+=1
        if a3<v2n1 and full[a3]:
            full2+=1
        full[use]=True
    #print(full,full2,use,a1,a2,a3)
    if full2==0:
        print('Yes')
    else:
        print('No')

    '''if full.get(use):
        if full.get((-use)+1):
            full2-=1
        if full.get((-use)):
            full2-=1
        if full.get((-use)-1):
            full2-=1
        full[use]=False
    else:
        if full.get((-use)+1):
            full2+=1
        if full.get((-use)):
            full2+=1
        if full.get((-use)-1):
            full2+=1
        full[use]=True
    if full2==0:
        print('Yes')
    else:
        print('No')'''


n,q=map(int,input().split())
full=set()
full2=0
for i in range(q):
    tap=list(map(int,input().split()))
    if tap[0]==1:
        use=tap[1]
    else:
        use=-tap[1]
    if use in full:
        if (-use)+1 in full:
            full2-=1
        if (-use) in full:
            full2-=1
        if (-use)-1 in full:
            full2-=1
        full.remove(use)
    else:
        if (-use)+1 in full:
            full2+=1
        if (-use) in full:
            full2+=1
        if (-use)-1 in full:
            full2+=1
        full.add(use)
    if full2==0:
        print('Yes')
    else:
        print('No')


n,q=map(int,input().split())
full=dict()
full2=0
for i in range(q):
    tap=list(map(int,input().split()))
    if tap[0]==1:
        use=tap[1]
    else:
        use=-tap[1]
    if full.get(use):
        if full.get((-use)+1):
            full2-=1
        if full.get((-use)):
            full2-=1
        if full.get((-use)-1):
            full2-=1
        full[use]=False
    else:
        if full.get((-use)+1):
            full2+=1
        if full.get((-use)):
            full2+=1
        if full.get((-use)-1):
            full2+=1
        full[use]=True
    if full2==0:
        print('Yes')
    else:
        print('No')


n,q=map(int,input().split())
#full=dict()
full=[False for i in range(2*n)]
full2=0
for i in range(q):
    tap=list(map(int,input().split()))
    #if tap[0]==1:
    #    use=tap[1]
    #else:
    #    use=-tap[1]
    use=tap[1]-1
    half=tap[0]
    if half==1:
        a1,a2,a3=use+n-1,use+n,use+n+1
    else:
        a1,a2,a3=use-1,use,use+1
        use=use+n
    if full[use]:
        if full[a1]:
            full2-=1
        if full[a2]:
            full2-=1
        if full[a3]:
            full2-=1
        full[use]=False
    else:
        if full[a1]:
            full2+=1
        if full[a2]:
            full2+=1
        if full[a3]:
            full2+=1
        full[use]=True
    #print(full,full2,use,a1,a2,a3)
    if full2==0:
        print('Yes')
    else:
        print('No')

    '''if full.get(use):
        if full.get((-use)+1):
            full2-=1
        if full.get((-use)):
            full2-=1
        if full.get((-use)-1):
            full2-=1
        full[use]=False
    else:
        if full.get((-use)+1):
            full2+=1
        if full.get((-use)):
            full2+=1
        if full.get((-use)-1):
            full2+=1
        full[use]=True
    if full2==0:
        print('Yes')
    else:
        print('No')'''


n,q=map(int,input().split())
#full=dict()
full=[False for i in range(2*n)]
full2=0
v2n1=2*n
ans=['No' for i in range(q)]
for i in range(q):
    tap=list(map(int,input().split()))
    #if tap[0]==1:
    #    use=tap[1]
    #else:
    #    use=-tap[1]
    use=tap[1]-1
    half=tap[0]

    if half==1:
        a1,a2,a3=use+n-1,use+n,use+n+1
    else:
        a1,a2,a3=use-1,use,use+1
        use=use+n
    if full[use]:
        if a1>-1 and full[a1]:
            full2-=1
        if full[a2]:
            full2-=1
        if a3<v2n1 and full[a3]:
            full2-=1
        full[use]=False
    else:
        if a1>-1 and full[a1]:
            full2+=1
        if full[a2]:
            full2+=1
        if a3<v2n1 and full[a3]:
            full2+=1
        full[use]=True
    #print(full,full2,use,a1,a2,a3)
    if full2==0:
        ans[i]='Yes'
print('\n'.join(ans))

'''if full.get(use):
        if full.get((-use)+1):
            full2-=1
        if full.get((-use)):
            full2-=1
        if full.get((-use)-1):
            full2-=1
        full[use]=False
    else:
        if full.get((-use)+1):
            full2+=1
        if full.get((-use)):
            full2+=1
        if full.get((-use)-1):
            full2+=1
        full[use]=True
    if full2==0:
        print('Yes')
    else:
        print('No')'''


import sys, math
import io, os
#data = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
#from bisect import bisect_left as bl, bisect_right as br, insort
#from heapq import heapify, heappush, heappop
#from collections import defaultdict as dd, deque, Counter
#from itertools import permutations,combinations
def data(): return sys.stdin.readline().strip()
def mdata(): return list(map(int, data().split()))
def outl(var) : sys.stdout.write(' '.join(map(str, var))+'\n')
def out(var) : sys.stdout.write(str(var)+'\n')
from decimal import Decimal
#from fractions import Fraction
#sys.setrecursionlimit(100000)
INF = float('inf')
mod = int(1e9)+7

n,q=mdata()
s=set()
mat=[[0]*n for i in range(2)]
cnt=0
for i in range(q):
    x,y=mdata()
    x-=1
    y-=1
    for i in range(-1,2):
        for j in range(-1,2):
            if -1<(x+i)<2 and -1<(y+j)<n and i!=0:
                if mat[x][y]==0:
                    if mat[x+i][y+j]==1:
                        cnt+=1
                else:
                    if mat[x+i][y+j]==1:
                        cnt-=1
    mat[x][y]=1-mat[x][y]
    if cnt==0:
        out("Yes")
    else:
        out("No")


#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 19 14:26:41 2020

@author: dennis
"""

def row_passable(grid, row):
    r = grid[row]
    if sum(r) == 0:
        return False
    elif (sum(r) == 1) and (grid[min(len(grid)-1, row+1)][grid[row].index(1)] == 0):
        return False
    elif (sum(r) == 1) and (grid[max(0, row-1)][grid[row].index(1)] == 0):
        return False
    return True

n, q = [int(x) for x in input().split()]
grid = [[1, 1] for _ in range(n)]
impassable = set()
for _ in range(q):
    r, c = [int(x)-1 for x in input().split()]
    grid[c][r] = int(not grid[c][r])
    for x in range(c-1, c+2):
        if 0 <= x <= n-1:
            p = row_passable(grid, x)
            if not p:
                impassable.add(x)
            else:
                if x in impassable:
                    impassable.remove(x)
    if impassable:
        print('No')
    else:
        print('Yes')
    for row in grid:
        print(row[0], row[1])
    print()


#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 19 14:26:41 2020

@author: dennis
"""

def row_passable(grid, row):
    r = grid[row]
    if sum(r) == 0:
        return False
    elif (sum(r) == 1) and (grid[min(len(grid)-1, row+1)][grid[row].index(1)] == 0):
        return False
    elif (sum(r) == 1) and (grid[max(0, row-1)][grid[row].index(1)] == 0):
        return False
    return True

n, q = [int(x) for x in input().split()]
grid = [[1, 1] for _ in range(n)]
impassable = set()
for _ in range(q):
    r, c = [int(x)-1 for x in input().split()]
    grid[c][r] = int(not grid[c][r])
    for x in range(c-1, c+2):
        if 0 <= x <= n-1:
            p = row_passable(grid, x)
            if not p:
                impassable.add(x)
            else:
                if x in impassable:
                    impassable.remove(x)
    if impassable:
        print('No')
    else:
        print('Yes')


#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 19 14:26:41 2020

@author: dennis
"""

def row_passable(grid, row):
    r = grid[row]
    if sum(r) == 0:
        return False
    elif (sum(r) == 1) and (grid[min(len(grid)-1, row+1)][grid[row].index(1)] == 0):
        return False
    elif (sum(r) == 1) and (grid[max(0, row-1)][grid[row].index(1)] == 0):
        return False
    return True

def passable_region(grid, region):
    for r in region[:-1]:
        if not row_passable(grid):
            return False
    return True

n, q = [int(x) for x in input().split()]
grid = [[1, 1] for _ in range(n)]
impassable = set()
for _ in range(q):
    r, c = [int(x)-1 for x in input().split()]
    grid[c][r] = int(not grid[c][r])
    p = row_passable(grid, c)
    ra = range(c-1, c+2)
    if not p:
        ra = range(c-1, c+2)
        if ra not in impassable:
            impassable.add(ra)
    else:
        if ra in impassable:
            impassable.remove(ra)
    if impassable:
        print('No')
    else:
        print('Yes')


#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 19 14:26:41 2020

@author: dennis
"""

def row_passable(grid, row):
    r = grid[row]
    if sum(r) == 0:
        return False
    elif (sum(r) == 1) and (grid[min(len(grid)-1, row+1)][grid[row].index(1)] == 0):
        return False
    elif (sum(r) == 1) and (grid[max(0, row-1)][grid[row].index(1)] == 0):
        return False
    return True

n, q = [int(x) for x in input().split()]
grid = [[1, 1] for _ in range(n)]
impassable = set()
for _ in range(q):
    r, c = [int(x)-1 for x in input().split()]
    grid[c][r] = int(not grid[c][r])
    new = grid[c][r]
    for x in range(c-1, c+2):
        if 0 <= x <= n-1:
            if (new == 0 and x not in impassable) or (new == 1 and x in impassable):
                p = row_passable(grid, x)
                if not p:
                    impassable.add(x)
                else:
                    if x in impassable:
                        impassable.remove(x)
    if impassable:
        print('No')
    else:
        print('Yes')


#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 19 14:26:41 2020

@author: dennis
"""

import atexit
import io
import sys

_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
    sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())

def row_passable(grid, row):
    r = grid[row]
    if sum(r) == 0:
        return False
    elif (sum(r) == 1) and (grid[min(len(grid)-1, row+1)][grid[row].index(1)] == 0):
        return False
    elif (sum(r) == 1) and (grid[max(0, row-1)][grid[row].index(1)] == 0):
        return False
    return True

n, q = [int(x) for x in input().split()]
grid = [[1, 1] for _ in range(n)]
impassable = set()
for _ in range(q):
    r, c = [int(x)-1 for x in input().split()]
    grid[c][r] = int(not grid[c][r])
    for x in range(c-1, c+2):
        if 0 <= x <= n-1:
            p = row_passable(grid, x)
            if not p:
                impassable.add(x)
            else:
                if x in impassable:
                    impassable.remove(x)
    if impassable:
        print('No')
    else:
        print('Yes')


#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 19 14:26:41 2020

@author: dennis
"""

def row_passable(grid, row):
    r = grid[row]
    if sum(r) == 0:
        return False
    elif (sum(r) == 1) and (grid[min(len(grid)-1, row+1)][grid[row].index(1)] == 0):
        return False
    elif (sum(r) == 1) and (grid[max(0, row-1)][grid[row].index(1)] == 0):
        return False
    return True

n, q = [int(x) for x in input().split()]
grid = [[1, 1] for _ in range(n)]
impassable = set()
for _ in range(q):
    r, c = [int(x)-1 for x in input().split()]
    grid[c][r] = int(not grid[c][r])
    p = row_passable(grid, c)
    if not p:
        impassable.add(c)
        if c >= 1:
            if not row_passable(grid, c-1):
                impassable.add(c-1)
        if c <= n-2:
            if not row_passable(grid, c+1):
                impassable.add(c+1)
    else:
        if c in impassable:
            impassable.remove(c)
        if c >= 1 and (c-1) in impassable:
            if row_passable(grid, c-1):
                impassable.remove(c-1)
        if c <= n-2 and (c+1) in impassable:
            if row_passable(grid, c+1):
                impassable.remove(c+1)
    if impassable:
        print('No')
    else:
        print('Yes')


#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 19 14:26:41 2020

@author: dennis
"""

def passable(grid):
    for i, row in enumerate(grid[:-1]):
        if sum(grid[i+1]) == 0:
            return 'No'
        elif (sum(row) == 1) and (grid[i+1][grid[i].index(1)] == 0):
            return 'No'
    return 'Yes'

n, q = [int(x) for x in input().split()]
grid = [[1, 1] for _ in range(n)]
for _ in range(q):
    r, c = [int(x)-1 for x in input().split()]
    grid[c][r] = int(not grid[c][r])
    print(passable(grid))


#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 19 14:26:41 2020

@author: dennis
"""

def row_passable(grid, row):
    r = grid[row]
    if sum(r) == 0:
        return False
    elif (sum(r) == 1) and (grid[min(len(grid)-1, row+1)][grid[row].index(1)] == 0):
        return False
    elif (sum(r) == 1) and (grid[max(0, row-1)][grid[row].index(1)] == 0):
        return False
    return True

n, q = [int(x) for x in input().split()]
grid = [[1, 1] for _ in range(n)]
impassable = set()
for _ in range(q):
    r, c = [int(x)-1 for x in input().split()]
    grid[c][r] = int(not grid[c][r])
    p = row_passable(grid, c)
    if not p:
        impassable.add(c)
    else:
        if c in impassable:
            impassable.remove(c)
    if impassable:
        print('No')
    else:
        print('Yes')


def add(blocks, r, c, i):
    blocks[c * 2 + r].add(i * 2 + 1 - r)
    blocks[i * 2 + 1 - r].add(c * 2 + r)

def remove(blocks, r, c):
    for ii in blocks[c * 2 + r]:
        blocks[ii].remove(c * 2 + r)
    result = len(blocks[c * 2 + r])
    blocks[c * 2 + r].clear()
    return result

def go():
    n, q = map(int, input().split())
    blocks = {i: set() for i in range(2 * n)}

    a = [[False] * n, [False] * n]

    total = 0
    for _ in range(q):
        r, c = map(lambda s: int(s) - 1, input().split())
        if a[r][c]:
            total -= remove(blocks, r, c)
        else:
            a[r][c] = True
            for i in {max(0, c - 1), c, min(n - 1, c + 1)}:
                if a[1 - r][i]:
                    add(blocks, r, c, i)
                    total += 1

        # print('Yes' if all(len(blocks[i]) == 0 for i in range(2 * n)) else 'No')
        print ('No' if total else 'Yes')

go()


def add(blocks, r, c, i):
    blocks[c * 2 + r].add(i * 2 + 1 - r)
    blocks[i * 2 + 1 - r].add(c * 2 + r)

def remove(blocks, r, c):
    for ii in blocks[c * 2 + r]:
        blocks[ii].remove(c * 2 + r)
    result = len(blocks[c * 2 + r])
    blocks[c * 2 + r].clear()
    return result

def go():
    n, q = map(int, input().split())
    blocks = {i: set() for i in range(2 * n)}

    a = [[False] * n, [False] * n]

    total = 0
    for _ in range(q):
        r, c = map(lambda s: int(s) - 1, input().split())
        if a[r][c]:
            a[r][c]=False
            total -= remove(blocks, r, c)
        else:
            a[r][c] = True
            for i in {max(0, c - 1), c, min(n - 1, c + 1)}:
                if a[1 - r][i]:
                    add(blocks, r, c, i)
                    total += 1

        # print('Yes' if all(len(blocks[i]) == 0 for i in range(2 * n)) else 'No')
        print ('No' if total else 'Yes')#, total)

go()


def go():
    n, q = map(int, input().split())
    blocks = [False] * (2 * n * 3)

    a = [False] * (2 * n)
    b = [0] * (2 * n)

    total = 0
    for _ in range(q):
        r, c = map(lambda s: int(s) - 1, input().split())
        rc = 2 * c + r
        if a[rc]:
            a[rc] = False
            for i in range(max(0, c - 1), min(n - 1, c + 1) + 1):
                if a[2 * i + 1 - r]:
                    total -= 1
        else:
            a[rc] = True
            for i in range(max(0, c - 1), min(n - 1, c + 1) + 1):
                if a[i * 2 + 1 - r]:
                    total += 1

        # print('Yes' if all(len(blocks[i]) == 0 for i in range(2 * n)) else 'No')
        print('No' if total else 'Yes')  # , total)

go()


def add(blocks, r, c, i):
    blocks[c * 2 + r].add(i * 2 + 1 - r)
    blocks[i * 2 + 1 - r].add(c * 2 + r)

def remove(blocks, r, c):
    for ii in blocks[c * 2 + r]:
        blocks[ii].remove(c * 2 + r)
    result = len(blocks[c * 2 + r])
    blocks[c * 2 + r].clear()
    return result

def go():
    n, q = map(int, input().split())
    blocks = {i: set() for i in range(2 * n)}

    a = [False] * (2 * n)

    total = 0
    for _ in range(q):
        r, c = map(lambda s: int(s) - 1, input().split())
        rc = 2 * c + r
        if a[rc]:
            a[rc] = False
            total -= remove(blocks, r, c)
        else:
            a[rc] = True
            for i in range(max(0, c - 1), min(n - 1, c + 1) + 1):
                if a[i * 2 + 1 - r]:
                    add(blocks, r, c, i)
                    total += 1

        # print('Yes' if all(len(blocks[i]) == 0 for i in range(2 * n)) else 'No')
        print('No' if total else 'Yes')  # , total)

go()


def add(blocks, r, c, d):
    blocks[(c * 2 + r) * 3 + 1 + d] = True
    blocks[((c + d) * 2 + 1 - r) * 3 + 1 - d] = True

def remove(blocks, r, c):
    result = 0
    cr = c * 2 + r
    for d in (-1, 0, 1):
        if blocks[cr * 3 + 1 + d]:
            blocks[((c + d) * 2 + 1 - r) * 3 + 1 - d] = False
            blocks[cr * 3 + 1 + d] = False
            result += 1
    return result

def go():
    n, q = map(int, input().split())
    blocks = [False] * (2 * n * 3)

    a = [False] * (2 * n)

    total = 0
    for _ in range(q):
        r, c = map(lambda s: int(s) - 1, input().split())
        rc = 2 * c + r
        if a[rc]:
            a[rc] = False
            total -= remove(blocks, r, c)
        else:
            a[rc] = True
            for i in range(max(0, c - 1), min(n - 1, c + 1) + 1):
                if a[i * 2 + 1 - r]:
                    add(blocks, r, c, i - c)
                    total += 1

        # print('Yes' if all(len(blocks[i]) == 0 for i in range(2 * n)) else 'No')
        print('No' if total else 'Yes')  # , total)

go()


def go():
    n, q = map(int, input().split())
    blocks = [False] * (2 * n * 3)

    a = [False] * (2 * n)
    # b = [0] * (2 * n)

    total = 0
    answers = ['']*q
    for qq in range(q):
        r, c = map(lambda s: int(s) - 1, input().split())
        rc = 2 * c + r
        if a[rc]:
            a[rc] = False
            for i in range(max(0, c - 1), min(n - 1, c + 1) + 1):
                if a[2 * i + 1 - r]:
                    total -= 1
        else:
            a[rc] = True
            for i in range(max(0, c - 1), min(n - 1, c + 1) + 1):
                if a[i * 2 + 1 - r]:
                    total += 1

        # print('Yes' if all(len(blocks[i]) == 0 for i in range(2 * n)) else 'No')

        # print('No' if total else 'Yes')  # , total)
        answers[qq] = 'No' if total else 'Yes'

    print(*answers, sep='\n')

go()


n, q = [int(x) for x in input().split(' ')]
grid = set()
problems = set()
for i in range(q):

    r, c = [int(x) for x in input().split(' ')]
    if (r, c) in grid:
        grid.remove((r,c))
        for j in range(min(0, c - 1), max(n + 1, c + 2)):
            if r == 1:
                x = ((r, c), (3 - r, j))
            else:
                x = ((3 - r, j), (r, c))
            if x in problems:
                problems.remove(x)
    else:
        grid.add((r, c))
        for j in range(min(0, c - 1), max(n + 1, c + 2)):
            if (3 - r, j) in grid:
                if r == 1:
                    x = ((r, c), (3 - r, j))
                else:
                    x = ((3 - r, j), (r, c))
                problems.add(x)
    ans = not problems
    if ans:
        print('Yes')
    else:
        print('No')


n, q = [int(x) for x in input().split(' ')]
grid = set()
problems = set()
for i in range(q):

    r, c = [int(x) for x in input().split(' ')]
    if (r, c) in grid:
        grid.remove((r,c))
        for j in range(max(1, c - 1), min(n + 1, c + 2)):
            if r == 1:
                x = ((r, c), (3 - r, j))
            else:
                x = ((3 - r, j), (r, c))
            if x in problems:
                problems.remove(x)
    else:
        grid.add((r, c))
        for j in range(max(1, c - 1), min(n + 1, c + 2)):
            if (3 - r, j) in grid:
                if r == 1:
                    x = ((r, c), (3 - r, j))
                else:
                    x = ((3 - r, j), (r, c))
                problems.add(x)

    if not problems and (2, n) not in grid and (1, 1) not in grid:
        print('Yes')
    else:
        print('No')


n, q = [int(x) for x in input().split(' ')]
grid = set()
problems = set()
for i in range(q):

    r, c = [int(x) for x in input().split(' ')]
    if (r, c) in grid:
        grid.remove((r,c))
        for j in range(min(0, c - 1), max(n, c + 1)):
            if r == 1:
                x = ((r, c), (3 - r, j))
            else:
                x = ((3 - r, j), (r, c))
            if x in problems:
                problems.remove(x)
    else:
        grid.add((r, c))
        for j in range(min(0, c - 1), max(n, c + 1)):
            if (3 - r, j) in grid:
                if r == 1:
                    x = ((r, c), (3 - r, j))
                else:
                    x = ((3 - r, j), (r, c))
                problems.add(x)
    ans = not problems
    if ans:
        print('Yes')
    else:
        print('No')


n, q = [int(x) for x in input().split(' ')]
grid = set()
problems = set()
for i in range(q):

    r, c = [int(x) for x in input().split(' ')]
    if (r, c) in grid:
        grid.remove((r,c))
        for j in range(min(0, c - 1), max(n + 1, c + 1)):
            if r == 1:
                x = ((r, c), (3 - r, j))
            else:
                x = ((3 - r, j), (r, c))
            if x in problems:
                problems.remove(x)
    else:
        grid.add((r, c))
        for j in range(min(0, c - 1), max(n + 1, c + 1)):
            if (3 - r, j) in grid:
                if r == 1:
                    x = ((r, c), (3 - r, j))
                else:
                    x = ((3 - r, j), (r, c))
                problems.add(x)
    ans = not problems
    if ans:
        print('Yes')
    else:
        print('No')


n, q = [int(x) for x in input().split(' ')]
grid = set()
problems = set()
for i in range(q):

    r, c = [int(x) for x in input().split(' ')]
    if (r, c) in grid:
        grid.remove((r,c))
        for j in range(min(0, c - 1), max(n, c + 1)):
            if r == 1:
                x = ((r, c), (3 - r, j))
            else:
                x = ((3 - r, j), (r, c))
            if x in problems:
                problems.remove(x)
    else:
        grid.add((r, c))
        for j in range(min(0, c - 1), max(n + 1, c + 1)):
            if (3 - r, j) in grid:
                if r == 1:
                    x = ((r, c), (3 - r, j))
                else:
                    x = ((3 - r, j), (r, c))
                problems.add(x)
    ans = not problems
    if ans:
        print('Yes')
    else:
        print('No')


import sys
input = sys.stdin.readline
n, q = [int(x) for x in input().split(' ')]
grid = set()
problems = set()
for i in range(q):

    r, c = [int(x) for x in input().split(' ')]
    if (r, c) in grid:
        grid.remove((r,c))
        for j in range(max(1, c - 1), min(n + 1, c + 2)):
            if r == 1:
                x = ((r, c), (3 - r, j))
            else:
                x = ((3 - r, j), (r, c))
            if x in problems:
                problems.remove(x)
    else:
        grid.add((r, c))
        for j in range(max(1, c - 1), min(n + 1, c + 2)):
            if (3 - r, j) in grid:
                if r == 1:
                    x = ((r, c), (3 - r, j))
                else:
                    x = ((3 - r, j), (r, c))
                problems.add(x)

    if not problems and (2, n) not in grid and (1, 1) not in grid:
        print('Yes')
    else:
        print('No')


n, q = [int(x) for x in input().split(' ')]
grid = set()
problems = set()
for i in range(q):

    r, c = [int(x) for x in input().split(' ')]
    if (r, c) in grid:
        grid.remove((r,c))
        for j in range(min(0, c - 1), max(n + 1, c + 2)):
            if r == 1:
                x = ((r, c), (3 - r, j))
            else:
                x = ((3 - r, j), (r, c))
            if x in problems:
                problems.remove(x)
    else:
        grid.add((r, c))
        for j in range(min(0, c - 1), max(n + 1, c + 2)):
            if (3 - r, j) in grid:
                if r == 1:
                    x = ((r, c), (3 - r, j))
                else:
                    x = ((3 - r, j), (r, c))
                problems.add(x)

    if not problems and (2, n) not in grid:
        print('Yes')
    else:
        print('No')


n, q = [int(x) for x in input().split(' ')]
grid = set()
problems = set()
for i in range(q):

    r, c = [int(x) for x in input().split(' ')]
    if (r, c) in grid:
        grid.remove((r,c))
        for j in range(min(0, c - 1), max(n + 1, c + 2)):
            if r == 1:
                x = ((r, c), (3 - r, j))
            else:
                x = ((3 - r, j), (r, c))
            if x in problems:
                problems.remove(x)
    else:
        grid.add((r, c))
        for j in range(min(0, c - 1), max(n + 1, c + 2)):
            if (3 - r, j) in grid:
                if r == 1:
                    x = ((r, c), (3 - r, j))
                else:
                    x = ((3 - r, j), (r, c))
                problems.add(x)

    if not problems and (2, n) not in grid and (1, 1) not in grid:
        print('Yes')
    else:
        print('No')


n,q=map(int,input().split())
list=[[0 for i in range(n)]for i in range(2)]
t=0
while q>0:
    q-=1
    x,y=map(lambda s:int(s)-1,input().split())
    delta=+1 if list[x][y]==0 else -1
    list[x][y]=1-list[x][y]
    for dy in range(-1,2):
        if y+dy>=0 and y+dy<n and list[1-x][y+dy]==1:
            t+=delta
    if t==0:
        print("Yes")
    else:
        print("No")


n,q=map(int,input().split())
list=[[0 for i in range(n)]for i in range(2)]
t=0
for _ in range(q):
    a,b=map(int,input().split())
    a-=1;b-=1
    if list[a][b]==0:
        list[a][b]=1
        if list[1-a][b]==1 or list[1-a][b-1]==1 or list[1-a][b+1]==1:
            t+=1
            print("No")
        else:
            print("Yes")
    else:
        list[a][b]=0
        if t>1:
            print("No")
        elif t==1:
            print("Yes")


n,q=map(int,input().split())
list=[[0 for i in range(n)]for i in range(2)]
t=0
if q==1:
    print("Yes")
else:
    for _ in range(q):
        a,b=map(int,input().split())
        a-=1;b-=1
        if list[a][b]==0:
            list[a][b]=1
            if list[1-a][b]==1 or list[1-a][b-1]==1 or list[1-a][b+1]==1:
                t+=1
                print("No")
            else:
                print("Yes")
        else:
            list[a][b]=0
            if t>1:
                print("No")
                if list[1 - a][b] == 1 or list[1 - a][b - 1] == 1 or list[1 - a][b + 1] == 1:
                    t-=1
            elif t==1:
                print("Yes")


n,q=map(int,input().split())
list=[[0 for i in range(n)]for i in range(2)]
t=0
for _ in range(q):
    a,b=map(int,input().split())
    a-=1;b-=1
    if list[a][b]==0:
        list[a][b]=1
        if list[1-a][b]==1 or list[1-a][b-1]==1 or list[1-a][b+1]==1:
            t+=1
            print("Yes")
        else:
            print("No")
    else:
        list[a][b]=0
        if t>1:
            print("No")
        elif t==1:
            print("Yes")


n,q=map(int,input().split())
list=[[0 for i in range(n)]for i in range(2)]
t=0
for _ in range(q):
    a,b=map(int,input().split())
    a-=1;b-=1
    if list[a][b]==0:
        list[a][b]=1
        if list[1-a][b]==1 or list[1-a][b-1]==1 or list[1-a][b+1]==1:
            t+=1
            print("No")
        else:
            print("Yes")
    else:
        list[a][b]=0
        if t>1:
            print("No")
            if list[1 - a][b] == 1 or list[1 - a][b - 1] == 1 or list[1 - a][b + 1] == 1:
                t-=1
        elif t==1:
            print("Yes")


n,q=map(int,input().split())
list=[[0 for i in range(n)]for i in range(2)]
t=0
while q>0:
    q-=1
    x,y=map(lambda s:int(s)-1,input().split())
    delta=+1 if list[x][y]==0 else -1
    lava[x][y]=1-lava[x][y]
    for dy in range(-1,2):
        if y+dy>=0 and y+dy<n and list[1-x][y+dy]==1:
            t+=delta
    if t==0:
        print("Yes")
    else:
        print("No")


n,q=map(int,input().split())
list=[[0 for i in range(n)]for i in range(2)]
t=0
if q==1:
    print("Yes")
else:
    for _ in range(q):
        a,b=map(int,input().split())
        a-=1;b-=1
        if list[a][b]==0:
            list[a][b]=1

            if b==0:
                if list[1-a][b+1]==1:
                    t+=1
                    print("No")
                else:
                    print("Yes")

            elif b==n-1:
                if list[1-a][b-1]==1:
                    t+=1
                    print("No")
                else:
                    print("Yes")

            else:
                if list[1-a][b]==1 or list[1-a][b-1]==1 or list[1-a][b+1]==1:
                    t+=1
                    print("No")
                else:
                    print("Yes")
        else:
            list[a][b]=0
            if t>1:
                print("No")
                if b == 0:
                    if list[1 - a][b + 1] == 1:
                        t-=1

                elif b == n - 1:
                    if list[1 - a][b - 1] == 1:
                        t-=1
                else:
                    if list[1 - a][b] == 1 or list[1 - a][b - 1] == 1 or list[1 - a][b + 1] == 1:
                        t-=1
            elif t==1:
                print("Yes")


from sys import stdin
input = stdin.readline

n,q=map(int,input().split(' '))
rows = [[True]*(n+3),[True]*(n+3)]
prev=True
s=set()
for _ in range(q):
    r,c=map(int,input().split(' '))
    rows[r-1][c] = not rows[r-1][c]
    if rows[r-1][c]:
        if (rows[r-1][c-2] and rows[r-1][c-1]):
            s.discard(c-1)
        if (rows[r-1][c-1] and rows[r-1][c+1]):
            s.discard(c)
        if (rows[r-1][c+1] and rows[r-1][c+2]):
            s.discard(c+1)
    else:
        if not (rows[r%2][c-1] and rows[r%2][c] and rows[r%2][c+1]):
            s.add(c)
    if len(s) == 0:
        print("Yes")
    else:
        print("No")

    #currRow = 0
    #currCol = 1
    #while currCol < n:
    #    if rows[currRow][currCol+1]:
    #        currCol += 1
    #    elif rows[currRow][currCol] and rows[currRow][currCol+1] and rows[currRow][currCol+2]:
    #        currCol += 2
    #        currRow ^= 1
    #    else:
    #        break
    #if currCol >= n:
    #    print("Yes")
    #else:
    #    print("No")


from sys import stdin
input = stdin.readline

n,q=map(int,input().split(' '))
rows = [[True]*(n+3),[True]*(n+3)]
prev=True
s=set()
for _ in range(q):
    r,c=map(int,input().split(' '))
    rows[r-1][c] = not rows[r-1][c]
    if rows[r-1][c]:
        if (rows[r-1][c-2] and rows[r-1][c-1]) or
        (rows[r-1][c-1] and rows[r%2][c-1] and rows[r%2][c-2]):
            s.discard(c-1)
        if (rows[r-1][c-1] and rows[r-1][c+1]) or
        (rows[r-1][c+1] and rows[r%2][c] and rows[r%2][c-1]) or
        (rows[r-1][c-1] and rows[r%2][c] and rows[r%2][c+1]):
            s.discard(c)
        if (rows[r-1][c+1] and rows[r-1][c+2]) or
        (rows[r-1][c+1] and rows[r%2][c+1] and rows[r%2][c+2]):
            s.discard(c+1)
    else:
        if not (rows[r%2][c-1] and rows[r%2][c] and rows[r%2][c+1]):
            s.add(c)
    if len(s) == 0:
        print("Yes")
    else:
        print("No")

    #currRow = 0
    #currCol = 1
    #while currCol < n:
    #    if rows[currRow][currCol+1]:
    #        currCol += 1
    #    elif rows[currRow][currCol] and rows[currRow][currCol+1] and rows[currRow][currCol+2]:
    #        currCol += 2
    #        currRow ^= 1
    #    else:
    #        break
    #if currCol >= n:
    #    print("Yes")
    #else:
    #    print("No")


from sys import stdin
input = stdin.readline

n,q=map(int,input().split(' '))
rows = [[True]*(n+2),[True]*(n+2)]
for _ in range(q):
    r,c=map(int,input().split(' '))
    rows[r-1][c] = not rows[r-1][c]
    currRow = 0
    currCol = 1
    while currCol < n:
        if rows[currRow][currCol+1]:
            currCol += 1
        elif rows[currRow][currCol] and rows[currRow][currCol+1] and rows[currRow][currCol+2]:
            currCol += 2
            currRow ^= 1
        else:
            break
    if currCol >= n:
        print("Yes")
    else:
        print("No")


from sys import stdin
input = stdin.readline

n,q=map(int,input().split(' '))
rows = [[True]*(n+2),[True]*(n+2)]
for _ in range(q):
    r,c=map(int,input().split(' '))
    rows[r-1][c] = not rows[r-1][c]
    flag=True
    for i in range(1,n):
        if not rows[1][i]:
            if not (rows[0][i-1] and rows[0][i] and rows[0][i+1]):
                flag = False
                break
    if flag: print("Yes")
    else: print("No")

    #currRow = 0
    #currCol = 1
    #while currCol < n:
    #    if rows[currRow][currCol+1]:
    #        currCol += 1
    #    elif rows[currRow][currCol] and rows[currRow][currCol+1] and rows[currRow][currCol+2]:
    #        currCol += 2
    #        currRow ^= 1
    #    else:
    #        break
    #if currCol >= n:
    #    print("Yes")
    #else:
    #    print("No")


from sys import stdin
input = stdin.readline

n,q=map(int,input().split(' '))
rows = [[True]*(n+3),[True]*(n+3)]
prev=True
s=set()
for _ in range(q):
    r,c=map(int,input().split(' '))
    rows[r-1][c] = not rows[r-1][c]
    if rows[r-1][c]:
        if (rows[r-1][c-2] and rows[r-1][c-1]) or (rows[r-1][c-1] and rows[r%2][c-1] and rows[r%2][c-2]):
            s.discard(c-1)
        if (rows[r-1][c-1] and rows[r-1][c+1]) or (rows[r-1][c+1] and rows[r%2][c] and rows[r%2][c-1]) or (rows[r-1][c-1] and rows[r%2][c] and rows[r%2][c+1]):
            s.discard(c)
        if (rows[r-1][c+1] and rows[r-1][c+2]) or (rows[r-1][c+1] and rows[r%2][c+1] and rows[r%2][c+2]):
            s.discard(c+1)
    else:
        if not (rows[r%2][c-1] and rows[r%2][c] and rows[r%2][c+1]):
            s.add(c)
    if len(s) == 0:
        print("Yes")
    else:
        print("No")

    #currRow = 0
    #currCol = 1
    #while currCol < n:
    #    if rows[currRow][currCol+1]:
    #        currCol += 1
    #    elif rows[currRow][currCol] and rows[currRow][currCol+1] and rows[currRow][currCol+2]:
    #        currCol += 2
    #        currRow ^= 1
    #    else:
    #        break
    #if currCol >= n:
    #    print("Yes")
    #else:
    #    print("No")


n,q=map(int,input().split())

game=[]
t=[0]*n
t1=[0]*n
game.append(t)
game.append(t1)
blocked_pair=0
for i in range(q):

    a,b=map(int,input().split())
    a=a-1
    b=b-1
    delta=0
    if(game[a][b]==0):
        game[a][b]=1
        delta=1
    else:
        game[a][b]=0
        delta=-1

    for k in range(-1,2):
        x=1-a
        y=b+k
        if(x>=0 and y<n and game[x][y]==1):
            blocked_pair+=delta

    if(blocked_pair==0):
        print("Yes")
    else:
        print("No")


n,q=map(int,input().split())

game=[]
t=[0]*n
t1=[0]*n
game.append(t)
game.append(t1)
blocked_pair=0
for i in range(q):

    a,b=map(int,input().split())
    a=a-1
    b=b-1
    delta=0
    if(game[a][b]==0):
        game[a][b]=1
        delta=1
    else:
        game[a][b]=0
        delta=-1

    for k in range(-1,2):
        x=1-a
        y=b+k
        if(y>=0 and y<n and game[x][y]==1):
            blocked_pair+=delta

    if(blocked_pair==0):
        print("Yes")
    else:
        print("No")


import sys
from math import log2,floor,ceil,sqrt
# import bisect
# from collections import deque

Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
INF = 10 ** 18
MOD = 10**9+7

# for _ in range(int(ri())):
n,q = Ri()
lis = list2d(2,n,0)
cnt  = 0
for i in range(q):
    a,b  = Ri()
    a-=1
    b-=1
    if lis[a][b] == 0:
        lis[a][b] = 1
        flag = False
        if a-1 >= 0 and b-1 >=  0 and lis[a-1][b-1] ==1:
            cnt+=1
            flag = True
        if a+1 <=1 and b+1 <=  n-1 and lis[a+1][b+1] ==1:
            cnt+=1
            flag = True
        if a-1 >= 0 and b+1 <  n and lis[a-1][b+1] ==1:
            cnt+=1
            flag = True
        if a+1 <=1 and b-1 >=0   and lis[a+1][b-1] ==1:
            cnt+=1
            flag = True
        if a-1 >= 0 and lis[a-1][b] == 1:
            cnt+=1
        if a+1 <= 1 and lis[a+1][b] == 1:
            cnt+=1
    elif lis[a][b] == 1:
        lis[a][b] = 0
        if a-1 >= 0 and b-1 >=  0 and lis[a-1][b-1] ==1:
            cnt-=1
            flag = True
        if a+1 <=1 and b+1 <=  n-1 and lis[a+1][b+1] ==1:
            cnt-=1
            flag = True
        if a-1 >= 0 and b+1 <  n and lis[a-1][b+1] ==1:
            cnt-=1
            flag = True
        if a+1 <=1 and b-1 >=0   and lis[a+1][b-1] ==1:
            cnt-=1
            flag = True
        if a-1 >= 0 and lis[a-1][b] == 1:
            cnt-=1
        if a+1 <= 1 and lis[a+1][b] == 1:
            cnt-=1
    # print(lis)
    if cnt == 0:
        Yes()
    else:
        No()


import sys
input = lambda: sys.stdin.readline().rstrip()
n, q = map(int, input().split())
move = []
for _ in range(q):
    r, c = map(int, input().split())
    move.append((r-1, c-1))
pos = [[0]*n for _ in range(2)]
r1 = [0]*n
cnt = 0
for r, c in move:
    pos[r][c] = 1-pos[r][c]
    if r==0:
        if pos[0][c]:
            if r1[c]:
                continue
            for i in range(max(0, c-1), min(n, c+2)):
                if pos[1][i]:
                    cnt += 1
                    r1[c] = 1
                    break
        else:
            if r1[c]==1:
                cnt -= 1
                r1[c] = 0
    else:
        if pos[r][c]:
            for i in range(max(0, c-1), min(n, c+2)):
                if r1[i]:
                    continue
                if pos[1-r][i]:
                    cnt += 1
                    r1[i] = 1
        else:
            for i in range(max(0, c-1), min(n, c+2)):
                if r1[i]==0:
                    continue
                for j in range(max(0, i-1), min(n, i+2)):
                    if pos[1][j]:
                        break
                else:
                    cnt -= 1
                    r1[i] = 0
    if cnt:
        print('No')
    else:
        print('Yes')


import sys
input = lambda: sys.stdin.readline().rstrip()
n, q = map(int, input().split())
move = []
for _ in range(q):
    r, c = map(int, input().split())
    move.append((r-1, c-1))
pos = [[0]*n for _ in range(2)]
r1 = [0]*n
cnt = 0
for r, c in move:
    pos[r][c] = 1-pos[r][c]
    if r==0:
        if pos[r][c]:
            if r1[c]:
                continue
            for i in range(max(0, c-1), min(n, c+2)):
                if pos[1-r][i]:
                    cnt += 1
                    r1[c] = 1
                    break
        else:
            if r1[c]==1:
                cnt -= 1
                r1[c] = 0
    else:
        if pos[r][c]:
            for i in range(max(0, c-1), min(n, c+2)):
                if r1[i]:
                    continue
                if pos[1-r][i]:
                    cnt += 1
                    r1[i] = 1
        else:
            for i in range(max(0, c-1), min(n, c+2)):
                if r1[i]==0:
                    continue
                for j in range(max(0, i-1), min(n, i+2)):
                    if pos[1][i]:
                        break
                else:
                    cnt -= 1
                    r1[j] = 0
    if cnt:
        print('No')
    else:
        print('Yes')


import sys
input = lambda: sys.stdin.readline().rstrip()
n, q = map(int, input().split())
move = []
for _ in range(q):
    r, c = map(int, input().split())
    move.append((r-1, c-1))
pos = [[0]*n for _ in range(2)]
r1 = [0]*n
cnt = 0
for r, c in move:
    pos[r][c] = 1-pos[r][c]
    if r==0:
        if pos[0][c]:
            if r1[c]:
                continue
            for i in range(max(0, c-1), min(n, c+2)):
                if pos[1][i]:
                    cnt += 1
                    r1[c] = 1
                    break
        else:
            if r1[c]==1:
                cnt -= 1
                r1[c] = 0
    else:
        if pos[r][c]:
            for i in range(max(0, c-1), min(n, c+2)):
                if r1[i]:
                    continue
                if pos[1-r][i]:
                    cnt += 1
                    r1[i] = 1
        else:
            for i in range(max(0, c-1), min(n, c+2)):
                if r1[i]==0:
                    continue
                for j in range(max(0, i-1), min(n, i+2)):
                    if pos[1][i]:
                        break
                else:
                    cnt -= 1
                    r1[i] = 0
    if cnt:
        print('No')
    else:
        print('Yes')


from bisect import bisect_left as bl
from bisect import bisect_right as br
import heapq
import math
from collections import *
from functools import reduce,cmp_to_key
import sys
input = sys.stdin.readline

# M = mod = 998244353
# def factors(n):return sorted(list(set(reduce(list.__add__,([i, n//i] forn() i in range(1, int(n**0.5) + 1) if n % i == 0)))))
# def inv_mod(n):return pow(n, mod - 2, mod)

def li():return [int(i) for i in input().rstrip('\n').split()]
def st():return input().rstrip('\n')
def val():return int(input().rstrip('\n'))
def li2():return [i for i in input().rstrip('\n').split(' ')]
def li3():return [int(i) for i in input().rstrip('\n')]

n,q = li()
l = []
ans = []
for i in range(q):l.append(li())
d = defaultdict(int)
essential = defaultdict(set)
for i in l:
    x,y = i
    d[(x,y)] = 1 - d[(x,y)]
    if d[(x,y)] == 1:
        if y == 1:
            if d[(3-x,y)] or d[(3 - x,y+1)]:
                ans.append('NO')

            else:ans.append('YES')
        elif y == n:
            if d[(3-x,y)] or d[(3-x,y-1)]:ans.append('NO')
            else:ans.append('YES')
        else:
            if d[(3-x,y)] or d[(3 - x,y+1)] or d[(3-x,y-1)]:ans.append('NO')
            else:ans.append('YES')

        if d[(3-x,y)]:
            essential[(3-x,y)].add((x,y))
            essential[(x,y)].add((3-x,y))
        if d[(3-x,y-1)]:
            essential[(3-x,y-1)].add((x,y))
            essential[(x,y)].add((3-x,y-1))
        if d[(3-x,y+1)]:
            essential[(3-x,y+1)].add((x,y))
            essential[(x,y)].add((3-x,y+1))

    else:
        if len(essential[(x,y)]):
            for j in essential[(x,y)]:
                essential[j].remove((x,y))
                if not len(essential[j]):essential.pop(j)
            essential.pop((x,y))
        ans.append('NO' if len(essential) else 'YES')

    # print(d)
    # print(essential)
print(*ans,sep = '\n')


from bisect import bisect_left as bl
from bisect import bisect_right as br
import heapq
import math
from collections import *
from functools import reduce,cmp_to_key
import sys
input = sys.stdin.readline

# M = mod = 998244353
# def factors(n):return sorted(list(set(reduce(list.__add__,([i, n//i] forn() i in range(1, int(n**0.5) + 1) if n % i == 0)))))
# def inv_mod(n):return pow(n, mod - 2, mod)

def li():return [int(i) for i in input().rstrip('\n').split()]
def st():return input().rstrip('\n')
def val():return int(input().rstrip('\n'))
def li2():return [i for i in input().rstrip('\n').split(' ')]
def li3():return [int(i) for i in input().rstrip('\n')]

n,q = li()
l = []
ans = []
for i in range(q):l.append(li())
d = defaultdict(int)
essential = defaultdict(set)
for i in l:
    # print('case ; ',i)
    x,y = i
    d[(x,y)] = 1 - d[(x,y)]
    if d[(x,y)] == 1:
        if y == 1:
            if d[(3-x,y)] or d[(3 - x,y+1)] or len(essential):
                ans.append('NO')
            else:ans.append('YES')
        elif y == n:
            if d[(3-x,y)] or d[(3-x,y-1)] or len(essential):ans.append('NO')
            else:ans.append('YES')
        else:
            if d[(3-x,y)] or d[(3 - x,y+1)] or len(essential) or d[(3-x,y-1)]:ans.append('NO')
            else:ans.append('YES')

        if d[(3-x,y)]:
            essential[(3-x,y)].add((x,y))
            essential[(x,y)].add((3-x,y))
        if d[(3-x,y-1)]:
            essential[(3-x,y-1)].add((x,y))
            essential[(x,y)].add((3-x,y-1))
        if d[(3-x,y+1)]:
            essential[(3-x,y+1)].add((x,y))
            essential[(x,y)].add((3-x,y+1))

    else:
        for j in essential[(x,y)]:
            essential[j].remove((x,y))
            if not len(essential[j]):
                essential.pop(j)
        essential.pop((x,y))
        ans.append('NO' if len(essential) else 'YES')
print(*ans,sep = '\n')


from bisect import bisect_left as bl
from bisect import bisect_right as br
import heapq
import math
from collections import *
from functools import reduce,cmp_to_key
import sys
input = sys.stdin.readline

# M = mod = 998244353
# def factors(n):return sorted(list(set(reduce(list.__add__,([i, n//i] forn() i in range(1, int(n**0.5) + 1) if n % i == 0)))))
# def inv_mod(n):return pow(n, mod - 2, mod)

def li():return [int(i) for i in input().rstrip('\n').split()]
def st():return input().rstrip('\n')
def val():return int(input().rstrip('\n'))
def li2():return [i for i in input().rstrip('\n').split(' ')]
def li3():return [int(i) for i in input().rstrip('\n')]

n,q = li()
l = []
ans = []
for i in range(q):l.append(li())
d = defaultdict(int)
essential = defaultdict(set)
for i in l:
    # print('quer y : ',i)
    x,y = i
    d[(x,y)] = 1 - d[(x,y)]
    if d[(x,y)] == 1:
        if y == 1:
            if d[(3-x,y)] or d[(3 - x,y+1)]:
                # print('check : ',d)
                ans.append('NO')
            else:ans.append('YES')
        elif y == n:
            if d[(3-x,y)] or d[(3-x,y-1)]:ans.append('NO')
            else:ans.append('YES')
        else:
            if d[(3-x,y)] or d[(3 - x,y+1)] or d[(3-x,y-1)]:ans.append('NO')
            else:ans.append('YES')

        if d[(3-x,y)]:
            essential[(3-x,y)].add((x,y))
            essential[(x,y)].add((3-x,y))
        if d[(3-x,y-1)]:
            essential[(3-x,y-1)].add((x,y))
            essential[(x,y)].add((3-x,y-1))
        if d[(3-x,y+1)]:
            essential[(3-x,y+1)].add((x,y))
            essential[(x,y)].add((3-x,y+1))

    else:
        # print('before : ',essential)
        for j in essential[(x,y)]:
            essential[j].remove((x,y))
            if not len(essential[j]):
                essential.pop(j)
        essential.pop((x,y))
        # print('Afet : ',essential)
        ans.append('NO' if len(essential) else 'YES')

    # print(d)
    # print(essential)
print(*ans,sep = '\n')


n,q=[int(x) for x in input().split(' ')]
list1=[0]*(10**5+1)
list2=[0]*(10**5+1)
list0=[0]*(10**5+1)
alist=[]
blist=[]
yon=0
for i in range(q):
    a,b=[int(x) for x in input().split(' ')]
    if a == 1:
        if list1[b] == 0:
            list1[b]=1
            list0[b]+=1
        else:
            list1[b]=0
            list0[b]-=1
    else:
        if list2[b] == 0:
            list2[b]=1
            list0[b]+=2
        else:
            list2[b]=0
            list0[b]-=2
    list0=[str(x) for x in list0]
    ansstr=''.join(list0)
    if '3' in ansstr or '12' in ansstr or '21' in ansstr:
        print('NO')
    else:
        print('YES')
    list0=[int(x) for x in list0]


import sys
input=sys.stdin.readline
n,q=[int(x) for x in input().split(' ')]
list1=[0]*(10**5+2)
list2=[0]*(10**5+2)
list0=[0]*(10**5+2)
w=0
for i in range(q):
    a,b=[int(x) for x in input().split(' ')]
    if a == 1:
        if list1[b] == 0:
            list1[b]=1
            list0[b]+=1
            for j in range(3):
                if list0[b+1-j] >= 2:
                    w+=1
        else:
            list1[b]=0
            list0[b]-=1
            for j in range(3):
                if list0[b+1-j] >= 2:
                    w-=1
    else:
        if list2[b] == 0:
            list2[b]=1
            list0[b]+=2
            for j in range(3):
                if abs(list0[b+1-j]-2) == 1:
                    w+=1
        else:
            list2[b]=0
            list0[b]-=2
            for j in range(3):
                if abs(list0[b+1-j]-2) == 1:
                    w-=1
    if w > 0:
        print('NO')
    else:
        print('YES')


n,q=[int(x) for x in input().split(' ')]
list1=[0]*(10**5+2)
list2=[0]*(10**5+2)
list0=[0]*(10**5+2)
w=0
for i in range(q):
    a,b=[int(x) for x in input().split(' ')]
    if a == 1:
        if list1[b] == 0:
            list1[b]=1
            list0[b]+=1
            for j in range(3):
                if list0[b+1-j] >= 2:
                    w+=1
        else:
            list1[b]=0
            list0[b]-=1
            for j in range(3):
                if list0[b+1-j] >= 2:
                    w-=1
    else:
        if list2[b] == 0:
            list2[b]=1
            list0[b]+=2
            for j in range(3):
                if abs(list0[b+1-j]-2) == 1:
                    w+=1
        else:
            list2[b]=0
            list0[b]-=2
            for j in range(3):
                if abs(list0[b+1-j]-2) == 1:
                    w-=1
    if w > 0:
        print('NO')
    else:
        print('YES')


def binarySearch(arr,x):
	l=0
	r=len(arr)-1
	while l <= r:
		mid = (l + r)//2;
		if arr[mid] == x:
			return mid
		elif arr[mid] < x:
			l = mid + 1
		else:
			r = mid - 1
	return -1

def js(arr,x):
	l=0
	r=len(arr)-1
	ans=-1
	while(l<=r):
		m=(l+r)//2
		if(arr[m]<=x):
			ans=m
			l=m+1
		else:
			r=m-1
	return ans

def jg(arr,x):
	l=0
	r=len(arr)-1
	ans=-1
	while(l<=r):
		m=(l+r)//2
		if(arr[m]>=x):
			ans=m
			r=m-1
		else:
			l=m+1
	return ans
from math import *

n,q = map(int,input().split())
dp=[]
dp.append([0]*n)
dp.append([0]*n)
block=0
for i in range(q):
	a,b=map(int,input().split())
	a-=1
	b-=1
	if(a==0):
		if(dp[a][b]==0):
			dp[a][b]=1
			block+=dp[a+1][b]
			if(b==0 or b<n-1):
				block+=dp[a+1][b+1]
			if(b==n-1 or b>0):
				block+=dp[a+1][b-1]
		else:
			dp[a][b]=0
			block-=dp[a+1][b]
			if(b==0 or b<n-1):
				block-=dp[a+1][b+1]
			if(b==n-1 or b>0):
				block-=dp[a+1][b-1]
	else:
		if(dp[a][b]==0):
			dp[a][b]=1
			block+=dp[a-1][b]
			if(b==0 or b<n-1):
				block+=dp[a-1][b+1]
			if(b==n-1 or b>0):
				block+=dp[a-1][b-1]
		else:
			dp[a][b]=0
			block-=dp[a-1][b]
			if(b==0 or b<n-1):
				block-=dp[a-1][b+1]
			if(b==n-1 or b>0):
				block-=dp[a-1][b-1]
	# print(block,dp,end=" ")
	if(block>0):
		print("No")
	else:
		print("Yes")


#include<bits/stdc++.h>
using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	long long int n;
	cin>>n;
	for(long long int i=0;i<n;i++)
	{
		long long int c,k;
		cin>>c>>k;
		if(k%c==0)cout<<(k*k)/c<<endl;
		else
		{
			if(k<=c)cout<<k<<endl;
			else
			{
				long long int t = k/c + 1;
				long long int x = k+c-c*t;
				cout<<x*t*t + (c-x)*(t-1)*(t-1)<<endl;
			}
		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	long long int n;
	cin>>n;
	for(long long int i=0;i<n;i++)
	{
		long long int c,k;
		cin>>c>>k;
		if(k%c==0)
		{
			cout<<(k*k)/c<<endl;
		}
		else
		{
			if(k<c)
			{
				cout<<k<<endl;
			}
			else
			{
				long long int t = k/c;
				// cout<<t<<endl;
				cout<<((c+1)/2)*t*t + (c/2)*(t+1)*(t+1)<<endl;
			}
		}
	}
	return 0;
}


// CPP program to calculate Different ways to
// represent N as sum of K non-zero integers.
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        lli a,b,c,d;
        cin>>a>>b;
        c=b/a;
        d=c+1;
        c=(b%a)*pow(c,2);
        d=(a-b%a)*pow(d,2);
        cout<<c+d<<endl;
    }
}


// CPP program to calculate Different ways to
// represent N as sum of K non-zero integers.
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        lli a,b,c,d;
        cin>>a>>b;
        c=b/a;
        d=c+1;
        c=(a-b%a)*pow(c,2);
        d=(b%a)*pow(d,2);
        cout<<c+d<<endl;
    }
}


#include <bits/stdc++.h>
using namespace std;
#define lli long long int
int bin(lli a,lli b)
{
    if(a==1&&b==2||(a==2&&b==1))
    return 1;
    else {
        lli i=std::min(a/2,b/2);
        lli min=std::min(a,b);
        lli max=std::max(a,b);
        min-=i;
        max-=2*i;
        if(min==0&&max==0)
        return 1;
        else if((min==1&&max==0)||(max==1&&min==0))
        return 0;
        else if(min==1&&max==2||(min==2&&max==1))
     return 1;
     else
       return bin(min,max);
    }
}
int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    cin>>t;
    while(t--)

    {
        lli i,j,k ,l,m,n,o,p,a,b;
        cin>>a>>b;
        lli min=std::min(a,b);
        lli max=std::max(a,b);
        if(max>2*min)
        {
            cout<<"NO"<<endl;
        }

        else{
            if((a+b)%3==0)
            cout<<"YES"<<endl;
            else
            cout<<"NO"<<endl;
        }
    }
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define si(x) scanf("%d",&x)
#define sc(x) scanf(" %c",&x)
#define sll(x) scanf("%I64d",&x)
int main()
{
    int n;
    si(n);
    int c,sum,temp,temp1;
    ll tsum;
    double d,k,k1;
    while(n--)
    {
        si(c);
        si(sum);
        if(sum==1)
            cout<<"1"<<endl;
        else if(c==1)
        {
            cout<<sum*sum<<endl;
        }
        else
        {
            if(c>=sum)
                cout<<sum<<endl;
            else
            {
                k=c;
                d=sum/k;
                temp=floor(d);
                k1=temp;
                k=d-k1;
                if(k>0)
                {
                    temp1=ceil(k*c);
                }
                else
                    temp1=0;
                tsum=temp*temp*(c-temp1)+(temp+1)*(temp+1)*temp1;
                cout<<tsum<<endl;
            }
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define si(x) scanf("%d",&x)
#define sc(x) scanf(" %c",&x)
#define sll(x) scanf("%I64d",&x)
int main()
{
    int n;
    si(n);
    int c,sum,tsum,temp,temp1;
    double d,k;
    while(n--)
    {
        si(c);
        si(sum);
        if(sum==1)
            cout<<"1"<<endl;
        else if(c==1)
        {
            cout<<sum*sum<<endl;
        }
        else
        {
            if(c>=sum)
                cout<<sum<<endl;
            else
            {
                k=c;
                d=sum/k;
                temp=floor(d);
                k=d-temp;
                if(k>0)
                    temp1=k*c;
                else
                    temp1=0;
                tsum=temp*temp*(c-temp1)+(temp+1)*(temp+1)*temp1;
                cout<<tsum<<endl;
            }
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define si(x) scanf("%d",&x)
#define sc(x) scanf(" %c",&x)
#define sll(x) scanf("%I64d",&x)
int main()
{
    int n;
    si(n);
    int c,sum,temp,temp1;
    ll tsum;
    double d,k,k1,k2;
    int i=1;
    while(n--)
    {
        //cout<<" NO ->>"<<i++<<"  ";
        si(c);
        si(sum);
        if(sum==1)
            cout<<"1"<<endl;
        else if(c==1)
        {
            cout<<sum*sum<<endl;
        }
        else
        {
            if(c>=sum)
                cout<<sum<<endl;
            else
            {
                k=c;
                d=sum/k;
                temp=floor(d);
                temp1=sum-temp*c;
                tsum=temp*temp*(c-temp1)+(temp+1)*(temp+1)*temp1;
                cout<<tsum<<endl;
            }
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define si(x) scanf("%d",&x)
#define sc(x) scanf(" %c",&x)
#define sll(x) scanf("%I64d",&x)
int main()
{
    int n;
    si(n);
    int c,sum,temp,temp1;
    ll tsum;
    double d,k,k1,k2;
    int i=1;
    while(n--)
    {
        //cout<<" NO ->>"<<i++<<"  ";
        si(c);
        si(sum);
        if(sum==1)
            cout<<"1"<<endl;
        else if(c==1)
        {
            cout<<sum*sum<<endl;
        }
        else
        {
            if(c>=sum)
                cout<<sum<<endl;
            else
            {
                k=c;
                d=sum/k;
                temp=floor(d);
                k1=temp;
                k=d-k1;
                if(k>0)
                {
                    temp1=k*c;
                    //cout<<temp1<<endl;
                }
                else
                    temp1=0;
                tsum=temp*temp*(c-temp1)+(temp+1)*(temp+1)*temp1;
                cout<<tsum<<endl;
            }
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define si(x) scanf("%d",&x)
#define sc(x) scanf(" %c",&x)
#define sll(x) scanf("%I64d",&x)
int main()
{
    int n;
    si(n);
    int c,sum,temp,temp1;
    ll tsum;
    double d,k;
    while(n--)
    {
        si(c);
        si(sum);
        if(sum==1)
            cout<<"1"<<endl;
        else if(c==1)
        {
            cout<<sum*sum<<endl;
        }
        else
        {
            if(c>=sum)
                cout<<sum<<endl;
            else
            {
                k=c;
                d=sum/k;
                temp=floor(d);
                k=d-temp;
                if(k>0)
                    temp1=k*c;
                else
                    temp1=0;
                tsum=temp*temp*(c-temp1)+(temp+1)*(temp+1)*temp1;
                cout<<tsum<<endl;
            }
        }
    }
    return 0;
}


#include<iostream.h>
int main(){
    int t;
    long a,b,i,k,sum;
    cin>>t;
    while(t--){
        cin>>b>>a;
        k=a/b;
        i=a%b;
        sum=(b-i)*k*k;
        sum+=i*(k+1)*(k+1);
        cout<<sum<<"\n";
    }
    return 0;
}


#include<bits/stdc++.h>
int main(){
    int t;
    long a,b,i,k,sum;
    cin>>t;
    while(t--){
        cin>>b>>a;
        k=a/b;
        i=a%b;
        sum=(b-i)*k*k;
        sum+=i*(k+1)*(k+1);
        cout<<sum<<"\n";
    }
    return 0;
}


#include<iostream>
using namespce std;
int main(){
    int t;
    long a,b,i,k,sum;
    cin>>t;
    while(t--){
        cin>>b>>a;
        k=a/b;
        i=a%b;
        sum=(b-i)*k*k;
        sum+=i*(k+1)*(k+1);
        cout<<sum<<"\n";
    }
    return 0;
}


include<bits/stdc++.h>
using namespace std;
int main(){
    int t;
    long a,b,i,k,sum;
    cin>>t;
    while(t--){
        cin>>b>>a;
        k=a/b;
        i=a%b;
        sum=(b-i)*k*k;
        sum+=i*(k+1)*(k+1);
        cout<<sum<<"\n";
    }
    return 0;


#include<bits/stdc++.h>
using namespace std;
int main(){
    int t;
    long a,b,i,k,sum;
    cin>>t;
    while(t--){
        cin>>b>>a;
        k=a/b;
        i=a%b;
        sum=(b-i)*k*k;
        sum+=i*(k+1)*(k+1);
        cout<<sum<<"\n";
    }
    return 0;


#include<iostream>
using namespace std;
int main(){
    int t;
    long a,b,i,k,sum;
    cin>>t;
    while(t--){
        cin>>b>>a;
        k=a/b;
        i=a%b;
        sum=(b-i)*k*k;
        sum+=i*(k+1)*(k+1);
        cout<<sum<<"\n";
    }
    return 0;
}


#include<iostream>
int main(){
    int t;
    long a,b,i,k,sum;
    cin>>t;
    while(t--){
        cin>>b>>a;
        k=a/b;
        i=a%b;
        sum=(b-i)*k*k;
        sum+=i*(k+1)*(k+1);
        cout<<sum<<"\n";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int t;
    long a,b,i,k,sum;
    cin>>t;
    while(t--){
        cin>>b>>a;
        k=a/b;
        i=a%b;
        sum=(b-i)*k*k;
        sum+=i*(k+1)*(k+1);
        cout<<sum<<"\n";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i;
    cin>>n;
    for(i=0; i<n; i++)
    {
        long long a,b,x,y,c=0;
        cin>>a>>b;
        x=b/a;
        y=b%a;
        for(i=1;i<=a-y;i++)
        {

            c+=(x*x);
        }
        x++;
        for(i=1;i<=y;i++)
        {
           c+=(x*x);
        }
        cout<<c<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i;
    cin>>n;
    while(n--)
    {
        long long a,b,x,y,c=0;
        cin>>a>>b;
        x=b/a;
        y=b%a;
        for(i=1;i<=a-y;i++)
        {

            c+=(x*x);
        }
        x++;
        for(i=1;i<=y;i++)
        {
           c+=(x*x);
        }
        cout<<c<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i;
    cin>>n;
    for(i=0;i<n;i++)
    {
        long long a,b,x,y;
        cin>>a>>b;
        x=b/a;
        y=b%a;
        if(a>b)
        {
            cout<<b<<endl;
        }
        else if(b%a==0)
        {
            if(a>1)
           cout<<(x*x)+(x*x)<<endl;
           else
            cout<<(y*y)+(y*y)+(x*x)<<endl;
        }
        else if(b%a!=0)
        {
            cout<<(y*y)+(y*y)+(x+x)<<endl;
        }
    }
}


#include<iostream>
using namespace std;
long long fun(long sum,long part)
{
    if(sum%part==0)
    {
        return sum*sum/part;
    }
    int a=fun(sum/part,part/2);
    int b=fun(sum-sum/part,part-part/2);
    return a+b;
}
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        long long n,sum;
        cin>>n>>sum;
        if(n>=sum)
        {
            cout<<sum<<endl;
            continue;
        }
        cout<<fun(sum,n)<<endl;
    }
}


#include<iostream>
using namespace std;
long long fun(long sum,long part)
{
    if(part==1)
        return sum*sum;
    if(sum%part==0)
    {
        return sum*sum/part;
    }
    int a=fun(sum/2,part/2);
    int b=fun(sum-sum/2,part-part/2);
    return a+b;
}
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        long long n,sum;
        cin>>n>>sum;
        if(n>=sum)
        {
            cout<<sum<<endl;
            continue;
        }
        cout<<fun(sum,n)<<endl;
    }
}


#include<iostream>
using namespace std;
long long fun(long long num,long long part)
{
    if(part==1)
        return num*num;
    long a=fun(num/2,part-part/2);
    long b=fun(num-num/2,part/2);
    return a+b;
}
int main()
{
    long t;
    cin>>t;
    while(t--)
    {
        long sum,n;
        cin>>n>>sum;
        if(n>=sum)
        {
            cout<<sum<<endl;
            continue;
        }
        cout<<fun(sum,n)<<endl;

    }
}


#include<iostream>
using namespace std;
long long gcd(long a,long b)
{
    if(min(a,b)==0)
        return max(a,b);
    return gcd(min(a,b),max(a,b)%min(a,b));
}
long long fun(long sum,long part)
{
    if(sum%part==0)
    {
        return sum*sum/part;
    }

    long gc=gcd(sum,part);
    if(gc!=1)
        return gc*fun(sum/gc,part/gc);

    int comp=sum/part;
    int rem=sum%part;
    int z=sum/part;
    return comp*comp*(part-1)+(comp+rem)*(comp+rem);
}
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        long long n,sum;
        cin>>n>>sum;
        if(n>=sum)
        {
            cout<<sum<<endl;
            continue;
        }
        cout<<fun(sum,n)<<endl;
    }
}


#include<iostream>
using namespace std;
long long fun(long long num,long long part)
{
    if(part==1)
        return num*num;
    if(num%part==0)
    {
        return part*fun(num/part,1);
    }
    long a=fun(num/2,part-part/2);
    long b=fun(num-num/2,part/2);
    return a+b;
}
long long fun2(long long num,long long part)
{

}
int main()
{
    long t;
    cin>>t;
    while(t--)
    {
        long sum,n;
        cin>>n>>sum;
        if(n>=sum)
        {
            cout<<sum<<endl;
            continue;
        }
        cout<<fun(sum,n)<<endl;

    }
}


#include<iostream>
using namespace std;
long long gcd(long a,long b)
{
    if(min(a,b)==0)
        return max(a,b);
    return gcd(min(a,b),max(a,b)%min(a,b));
}
long long fun(long sum,long part)
{
    if(sum%part==0)
    {
        return sum*sum/part;
    }

    long gc=gcd(sum,part);
    if(gc!=1)
        return gc*fun(sum/gc,part/gc);

    int comp=sum/part;
    int rem=sum%part;
    int z=sum/part;
    return comp*comp*(part-rem)+(comp+1)*(comp+1)*rem;
}
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        long long n,sum;
        cin>>n>>sum;
        if(n>=sum)
        {
            cout<<sum<<endl;
            continue;
        }
        cout<<fun(sum,n)<<endl;
    }
}


#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int n;
    cin>>n;
    while(n--){
        ll c,s,ans=0,temp,r,i;
        cin>>c>>s;
        int arr[c];
        if(c==1)
            ans=s*s;
        else if(s<c)
            ans=s;
            else{
            temp=s/c;
           // cout<<temp<<endl;
            for(i=0;i<c;i++)
                arr[i]=temp;
            //memset(arr,temp,sizeof(arr));
            r=s%c;
            for(i=0;i<r;i++){
                arr[i]=arr[i]+1;
            }
            for(i=0;i<c;i++)
           //     cout<<arr[i]<<" ";
           // cout<<endl;
            for(i=0;i<c;i++)
                ans+=arr[i]*arr[i];
            }
            cout<<ans<<endl;
    }
}


#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int n;
    cin>>n;
    while(n--){
        ll c,s,ans=0,temp,r,i;
        cin>>c>>s;
        int arr[c];
        if(c==1)
            ans=s*s;
        else if(s<c)
            ans=c;
            else{
            temp=s/c;
           // cout<<temp<<endl;
            for(i=0;i<c;i++)
                arr[i]=temp;
            //memset(arr,temp,sizeof(arr));
            r=s%c;
            for(i=0;i<r;i++){
                arr[i]=arr[i]+1;
            }
            for(i=0;i<c;i++)
           //     cout<<arr[i]<<" ";
           // cout<<endl;
            for(i=0;i<c;i++)
                ans+=arr[i]*arr[i];
            }
            cout<<ans<<endl;
    }
}


#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int n;
    cin>>n;
    while(n--){
        ll c,s,ans=0,temp,r,i;
        cin>>c>>s;
        int arr[c];
        if(c==1)
            ans=s*s;
        else if(s<c)
            ans=1;
            else{
            temp=s/c;
           // cout<<temp<<endl;
            for(i=0;i<c;i++)
                arr[i]=temp;
            //memset(arr,temp,sizeof(arr));
            r=s%c;
            for(i=0;i<r;i++){
                arr[i]=arr[i]+1;
            }
            for(i=0;i<c;i++)
           //     cout<<arr[i]<<" ";
           // cout<<endl;
            for(i=0;i<c;i++)
                ans+=arr[i]*arr[i];
            }
            cout<<ans<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std ;
#define push_back pb
typedef long long ll;
typedef long double ld;

int main()
{
    ll n;
    cin>>n;
    while(n--)
    {
        ll c,sum;
        cin>>c>>sum;
         ll a=sum/c,b=sum%c;
        cout<<(ll)a*a*(c-b)+(a+1)*(a+1)*b<<"\n";

    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std ;
#define push_back pb
typedef long long ll;
typedef long double ld;

int main()
{
    int n;
    cin>>n;
    while(n--)
    {
        int c,sum;
        cin>>c>>sum;
         int a=sum/c,b=sum%c;
        cout<<pow(a,2)*(c-b)+pow(a+1,2)*b<<"\n";

    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std ;
#define push_back pb
typedef long long ll;
typedef long double ld;

int main()
{
    int n;
    cin>>n;
    while(n--)
    {
        int c,sum;
        cin>>c>>sum;
         a=sum/c,b=sum%c;
        cout<<pow(a,2)*(c-b)+pow(a+1,2)*b<<"\n";

    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main(){
	int n;
	cin >> n;
	while(n--){
		int c, sum;
		cin >> c >> sum;
		if(sum <= c){
			cout << sum << endl;
			continue;
		}
		if(sum % c == 0){
			cout << (sum/c)*(sum/c)*c << endl;
		} else{
			int x = sum/c + 1;
			int more = c*x - sum;
			cout << more + (sum-more)/(c-more)*x*x << endl;
		}
	}
}


#include <bits/stdc++.h>
using namespace std;

int main(){
	int n;
	cin >> n;
	while(n--){
		int c, sum;
		cin >> c >> sum;
		if(sum <= c){
			cout << sum << endl;
			continue;
		}
		int x = sum/c;
		cout << (sum-x*c)*(x+1)*(x+1) + (c-sum+x*c)*x*x << endl;
	}
}


#include <bits/stdc++.h>
using namespace std;

int main(){
	int n;
	cin >> n;
	while(n--){
		int c, sum;
		cin >> c >> sum;
		if(sum <= c){
			cout << sum << endl;
			continue;
		}
		if(sum % c == 0){
			cout << (sum/c)*(sum/c)*c << endl;
		} else{
			int x = sum/c + 1;
			int more = c*x - sum;
			cout << more + (c-more)*x*x << endl;
		}
	}
}


#include <bits/stdc++.h>
using namespace std;

int main(){
	int n;
	cin >> n;
	while(n--){
		int c, sum;
		cin >> c >> sum;
		if(sum <= c){
			cout << sum << endl;
			continue;
		}
		if(sum % c == 0){
			cout << (sum/c)*(sum/c)*c << endl;
		} else{
			int x = sum/c + 1;
			int more = c*x - sum;
			cout << more*more + (sum-more)/(c-more)*x*x << endl;
		}
	}
}


#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main() {
   ll n;
cin>>n;
 ll a,b;
for(ll i = 0;i<n;i++){
   cin>>a>>b;
   ll cnt = 0;
   if(a == 1){
       ll d = b*b;
       cout<<d<<"\n";
       cnt = -1;
   }
   else if(b == 1 && cnt == 0){
       cout<<"1"<<"\n";
   }
   else{

       ll ans = INT_MAX;
       for(ll g = 1;g<=b;g++){
       	ll r = b;
       ll ao = a;
           if(g*a>=b){
               ll p = g;
               ll as = 0;
           //    cout<<p<<"\n";
               while(r>0 ){
r-= p;
// cout<<p<<"\n";
as += p*p;
ao--;
if(ao == 0 && r != 0){
	as = INT_MAX;
	break;
}
if(ao == 0 && r == 0){
	break;
}

if(r%ao == 0){
    p = r/ao;

}
else{
    p = r/ao +1;
}

               }
               if(as == 0){
               	as == INT_MAX;
               }
               ans = min(ans,as);
           }
       }
       cout<<ans<<"\n";
   }

}
}


#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main() {
   ll n;
cin>>n;
 ll a,b;
for(ll i = 0;i<n;i++){
   cin>>a>>b;
   ll cnt = 0;
   if(a == 1){
       ll d = b*b;
       cout<<d<<"\n";
       cnt = -1;
   }
   else if(b == 1 && cnt == 0){
       cout<<"1"<<"\n";
   }
   else{

       ll ans = INT_MAX;
       ll g;
      if(b%a != 0){
          g = b/a + 1;
      }
      else{
          g = b/a;
      }
       	ll r = b;
       ll ao = a;
           if(g*a>=b){
               ll p = g;
               ll as = 0;
           //    cout<<p<<"\n";
               while(r>0 ){
r-= p;
// cout<<p<<"\n";
as += p*p;
ao--;
if(ao == 0 && r != 0){
	as = INT_MAX;
	break;
}
if(ao == 0 && r == 0){
	break;
}

if((r/ao)*ao == r){
    p = r/ao;

}
else{
    p = r/ao +1;
}

               }
               if(as == 0){
               	as == INT_MAX;
               }
               ans = min(ans,as);
           }
            cout<<ans<<"\n";
       }

}
}


#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main() {
   ll n;
cin>>n;
 ll a,b;
for(ll i = 0;i<n;i++){
   cin>>a>>b;
   ll cnt = 0;
   if(a == 1){
       ll d = b*b;
       cout<<d<<"\n";
       cnt = -1;
   }
   else if(b == 1 && cnt == 0){
       cout<<"1"<<"\n";
   }
   else{

       ll ans = INT_MAX;
       ll pu;
       if(b%a == 0){
           pu = b/a;
       }
       else{
           pu = b/a +1 ;
       }
       for(ll g = pu;g<=b;g++){
       	ll r = b;
       ll ao = a;
           if(g*a>=b){
               ll p = g;
               ll as = 0;
           //    cout<<p<<"\n";
               while(r>0 ){
r-= p;
// cout<<p<<"\n";
as += p*p;
ao--;
if(ao == 0 && r != 0){
	as = INT_MAX;
	break;
}
if(ao == 0 && r == 0){
	break;
}

if((r/ao)*ao == r){
    p = r/ao;

}
else{
    p = r/ao +1;
}

               }
               if(as == 0){
               	as == INT_MAX;
               }
               ans = min(ans,as);
           }
       }
       cout<<ans<<"\n";
   }

}
}


#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main() {
   ll n;
cin>>n;
 ll a,b;
for(ll i = 0;i<n;i++){
   cin>>a>>b;
   ll cnt = 0;
   if(a == 1){
       ll d = b*b;
       cout<<d<<"\n";
       cnt = -1;
   }
   else if(b == 1 && cnt == 0){
       cout<<"1"<<"\n";
   }
   else{
       ll ans = INT_MAX;
       for(ll h = 1;h<=10000;h++){
           ll s = h;
          ll so = s*a;
           if(so>=b){
               if(b%s == 0){
                   ll gfd = (b/s)*h*h;
                   ans = min(gfd,ans);
               }
               else{
ll er = ((b/s) + 1)*h*h;
ans = min(ans,er);
               }
           }
       }
       cout<<ans<<"\n";
   }

}
}


#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main() {
   ll n;
cin>>n;
 ll a,b;
for(ll i = 0;i<n;i++){
   cin>>a>>b;
   ll cnt = 0;
   if(a == 1){
       ll d = b*b;
       cout<<d<<"\n";
       cnt = -1;
   }
   else if(b == 1 && cnt == 0){
       cout<<"1"<<"\n";
   }
   else{

       ll ans = INT_MAX;
       for(ll g = 1;g<=b;g++){
       	ll r = b;
       ll ao = a;
           if(g*a>=b){
               ll p = g;
               ll as = 0;
           //    cout<<p<<"\n";
               while(r>0 ){
r-= p;
// cout<<p<<"\n";
as += p*p;
ao--;
if(ao == 0 && r != 0){
	as = INT_MAX;
	break;
}
if(ao == 0 && r == 0){
	break;
}

if((r/ao)*ao == r){
    p = r/ao;

}
else{
    p = r/ao +1;
}

               }
               if(as == 0){
               	as == INT_MAX;
               }
               ans = min(ans,as);
           }
       }
       cout<<ans<<"\n";
   }

}
}


#include <bits/stdc++.h>

using namespace std;

#define STB ios_base::sync_with_stdio(0); cin.tie(0), cout.tie(0);

long long ans(int c, int sum) {
    long long ans = 0;
    if(c >= sum)
        ans = sum;

    else {
        if(sum % c != 0)
            do {
                ans++;
                c--;
                sum--;
            } while (sum % c != 0);
        ans += ((sum / c) * (sum / c)) * c;
    }
    return ans;
}

int main()
{
    STB;
    int n;
    cin >> n;
    long long c[n], sum[n];
    for (int i = 0; i < n; i++)
        cin >> c[i] >> sum[i];

    for (int i = 0; i < n; i++) {
        cout << ans(c[i], sum[i]) << endl;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define STB ios_base::sync_with_stdio(0); cin.tie(0), cout.tie(0);

int main()
{
    int n;
    cin >> n;
    int c[n], sum[n];
    for (int i = 0; i < n; i++)
        cin >> c[i] >> sum[i];

    for (int i = 0; i < n; i++) {
        long long a = sum[i] / c[i];
        long long b = sum[i] % c[i];
        cout << (a * a * c[i] + 2 * a * b + b) << endl;
    }
}


#include <bits/stdc++.h>

using namespace std;

#define STB ios_base::sync_with_stdio(0); cin.tie(0), cout.tie(0);

long long ans(int c, int sum) {
    if(c >= sum)
        return sum;

    else {
        if (sum % c == 0)
            return (sum / c) * (sum / c) * c;

        else {
            long long ans = 0;

            if(sum > 2 && c > 2)
                do {
                    ans++;
                    c--;
                    sum--;
                } while(sum % c != 0 && (sum > 2 && c > 2));

            ans += ((int(sum / c) * int(sum / c)) * (c - 1)) + ((int(sum / c) + sum % c) * (int(sum / c) + sum % c));
            return ans;
        }
    }
}

int main()
{
    STB;
    int n;
    cin >> n;
    long long c[n], sum[n];
    for (int i = 0; i < n; i++)
        cin >> c[i] >> sum[i];

    for (int i = 0; i < n; i++) {
        cout << ans(c[i], sum[i]) << endl;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define STB ios_base::sync_with_stdio(0); cin.tie(0), cout.tie(0);

long long ans(int c, int sum) {
    if(c >= sum)
        return sum;

    else {
        if (sum % c == 0)
            return (sum / c) * (sum / c) * c;

        else {
            long long ans = 0;
            do {
                ans++;
                c--;
                sum--;
            } while(sum % c != 0 && (sum > 2 && c > 2));
            ans += ((int(sum / c) * int(sum / c)) * (c - 1)) + ((int(sum / c) + sum % c) * (int(sum / c) + sum % c));
            return ans;
        }
    }
}

int main()
{
    STB;
    int n;
    cin >> n;
    long long c[n], sum[n];
    for (int i = 0; i < n; i++)
        cin >> c[i] >> sum[i];

    for (int i = 0; i < n; i++) {
        cout << ans(c[i], sum[i]) << endl;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define STB ios_base::sync_with_stdio(0); cin.tie(0), cout.tie(0);

long long ans(int c, int sum) {
    long long ans = 0;
    if(c >= sum)
        ans = sum;

    else {
        if(sum % c != 0)
            do {
                ans++;
                c--;
                sum--;
            } while (sum % c != 0);
        ans += (sum / c * sum / c) * c;
    }
    return ans;
}

int main()
{
    STB;
    int n;
    cin >> n;
    long long c[n], sum[n];
    for (int i = 0; i < n; i++)
        cin >> c[i] >> sum[i];

    for (int i = 0; i < n; i++) {
        cout << ans(c[i], sum[i]) << endl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
    long t;
    cin>>t;
    for(long z=0;z<t;z++)
    {
        long n,m;
        cin>>n>>m;
        if(n>m)
        {
            long c=0;
            for(long i=0;i<m;i++)
                c=c+1;
            cout<<c<<endl;
        }

        else
        {
            int k=m%n;
            int l=m/n;
            long c=0;
            for(int i=0;i<n-k;i++)
                c=c+l*l;
            if(m%n!=0)
            {
              for(int i=0;i<k;i++)
                c=c+(l+1)*(l+1);
        }
        cout<<c<<endl;
            }

    }

}


#include <bits/stdc++.h>
using namespace std;
int main()
{
    long t;
    cin>>t;
    for(long z=0;z<t;z++)
    {
        long n,m;
        cin>>n>>m;
        if(n>m)
        {
            long c=0;
            for(long i=0;i<m;i++)
                c=c+1;
            cout<<c<<endl;
        }

        else
        {
            int k=m%n;
            int l=m/n;
            long c=0;
            for(int i=0;i<n-k;i++)
                c=c+l*l;
            if(m%n!=0)
            {
              for(int i=k;i<n;i++)
                c=c+(l+1)*(l+1);
        }
        cout<<c<<endl;
            }

    }

}


#include <bits/stdc++.h>
using namespace std;
int main()
{
    long t;
    cin>>t;
    for(long z=0;z<t;z++)
    {
        long n,m;
        cin>>n>>m;
        if(n>m)
            cout<<m*m<<endl;
        else
        {
            int k=m%n;
            int l=m/n;
            long c=0;
            for(int i=0;i<n-k;i++)
                c=c+l*l;
            if(m%n!=0)
            {
              for(int i=k;i<n;i++)
                c=c+(l+1)*(l+1);
        }
        cout<<c<<endl;
            }

    }

}


#include <algorithm>
#include <cstring>
#include <iostream>
#include <cstring>
#define inf 0x3f3f3f3f
using namespace std;

int main()
{
	int n;
	cin >> n;
	while (n--)
	{
		int x, y;
		cin >> x >> y;
		if (y % x == 0)
		{
			int t = y/x;
			cout << t * t * x<< endl;
		}
		else
		{
			int t = y / x;
			int a = (t + 1) * x - y;
			cout << (t + 1) * (t + 1) *(x - a) + t * t * a<<endl;
		}

	}
	return 0;
}


#include <algorithm>
#include <cstring>
#include <iostream>
#include <cstring>
#define inf 0x3f3f3f3f
using namespace std;

int main()
{
	int n;
	cin >> n;
	while (n--)
	{
		int x, y;
		cin >> x >> y;
		if (y % x == 0)
		{
			int t = y/x;
			cout << t * t * x<< endl;
		}
		else
		{
			int t = y % x;
			int tt = y/x;

			cout << (tt + 1) * (tt + 1) * t + (y - ((tt + 1) * t))*tt*tt << endl;
		}

	}
	return 0;
}


#include <algorithm>
#include <cstring>
#include <iostream>
#include <cstring>
#define inf 0x3f3f3f3f
using namespace std;

int main()
{
	int n;
	cin >> n;
	while (n--)
	{
		int x, y;
		cin >> x >> y;
		if (y % x == 0)
		{
			int t = y/x;
			cout << t * t * x<< endl;
		}
		else
		{
			int t = y % x;
			int tt = y/x;

			cout << (tt + 1) * (tt + 1) * t + (y - (tt + 1)*t) << endl;
		}

	}
	return 0;
}


#include <algorithm>
#include <cstring>
#include <iostream>
#include <cstring>
#define inf 0x3f3f3f3f
using namespace std;

int main()
{
	int n;
	cin >> n;
	while (n--)
	{
		int x, y;
		cin >> x >> y;
		if (y % x == 0)
		{
			int t = y/x;
			cout << t * t * x<< endl;
		}
		else
		{
			int t = y % x;
			int tt = y/x;

			cout << (tt + 1) * (tt + 1) * t + (y - t)*tt*tt << endl;
		}

	}
	return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define f(i,x,n) for(ll int i=x;i<n;i++)
#define re(j,x,n) for(ll int j=x;j>=n;j--)
#define f1(k,x,n) for(ll int k=x;k<=n;k++)
#define mp make_pair
#define pb push_back
#define mod 1000000007
#define MAX 1000001
using namespace std;

vector<pair<int,int> >op;
string s,t;
int isprime(ll n){
    if(n==2 || n==3) return 1;
    for(int i=2;i*i<=n;i++){
        if(n%i==0) return 0;
    }
    return 1;
}

void solve(){
    ll n,m,d,s=0,f=0,ans=0;
    cin>>n>>m;
    if(n>m){
        if(m%2==0) ans+=(m*m)/2;
        else{
            ans+=((m/2)+1)*((m/2)+1);
            ans+=(m/2)*(m/2);
        }
        cout<<ans<<"\n";
        return;
    }
    s=m%n;
    d=ceil(m*1.0/n);
    f=m/n;
    ans+=s*f*f;
    n = (m-s)/d;
    ans+=d*n*d;
    cout<<ans<<"\n";
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll int q;
    cin>>q;
    while(q--){
        solve();
    }
    return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define f(i,x,n) for(ll int i=x;i<n;i++)
#define re(j,x,n) for(ll int j=x;j>=n;j--)
#define f1(k,x,n) for(ll int k=x;k<=n;k++)
#define mp make_pair
#define pb push_back
#define mod 1000000007
#define MAX 1000001
using namespace std;

vector<pair<int,int> >op;
string s,t;
int isprime(ll n){
    if(n==2 || n==3) return 1;
    for(int i=2;i*i<=n;i++){
        if(n%i==0) return 0;
    }
    return 1;
}

void solve(){
    ll n,m,d,s=0,f=0,ans=0;
    cin>>n>>m;
    if(n>=m){
        ans=m;
        cout<<ans<<"\n";
        return;
    }
    s=m%n;
    d=ceil(m*1.0/n);
    f=m/n;
    ans+=(n-s)*f*f;
    n = (n-s)/d;
    ans+=d*s*d;
    cout<<ans<<"\n";
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll int q;
    cin>>q;
    while(q--){
        solve();
    }
    return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define f(i,x,n) for(ll int i=x;i<n;i++)
#define re(j,x,n) for(ll int j=x;j>=n;j--)
#define f1(k,x,n) for(ll int k=x;k<=n;k++)
#define mp make_pair
#define pb push_back
#define mod 1000000007
#define MAX 1000001
using namespace std;

vector<pair<int,int> >op;
string s,t;
int isprime(ll n){
    if(n==2 || n==3) return 1;
    for(int i=2;i*i<=n;i++){
        if(n%i==0) return 0;
    }
    return 1;
}

void solve(){
    ll n,m,d,s=0,f=0,ans=0;
    cin>>n>>m;
    if(n>m){
        if(m%2==0) ans+=(m*m)/2;
        else{
            ans+=((m/2)+1)*((m/2)+1);
            ans+=(m/2)*(m/2);
        }
        cout<<ans<<"\n";
        return;
    }
    s=m%n;
    d=ceil(m*1.0/n);
    f=m/n;
    ans+=(n-s)*f*f;
    n = (n-s)/d;
    ans+=d*s*d;
    cout<<ans<<"\n";
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll int q;
    cin>>q;
    while(q--){
        solve();
    }
    return 0;
}


#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<cstdio>
#include<math.h>
#include<memory.h>
#include<map>
#pragma warning(disable:4996)
#define maxn 0x7fffffff;
using namespace std;
typedef long long ll;
int gcd(int m, int n)
{
	return n ? gcd(n, m % n) : m;
}
bool cmp(int a, int b)
{
	return a > b;
}
int prime(int n)
{
	int flag = 0;
	for (int i = 2; i <= sqrt(n * 1.00); ++i)
	{
		if (n % i == 0)
		{
			flag = 1;
			return 1;
		}
	}
	if (flag == 0)
		return 0;
}
void swap(int a, int b)
{
	int t = a;
	a = b;
	b = t;
}
int pail(int m)
{
	int sum = 0;
	int n = m;
	while (m)
	{
		sum = sum * 10 + m % 10;
		m /= 10;
	}
	if (n == sum)
		return 1;
	else
		return 0;
}
map<int, int> v;
int main()
{
	int t;
	cin >> t;
	while (t--)
	{
		int c, s;
		cin >> c >> s;
		if (c >= s)
			cout << s * s << endl;
		else if (c == s)
			cout << s << endl;
		else if (s%c==0)
			cout << (s/c) * (s/c)*c << endl;
		else
		{
			int n = s / c;
			int sum = 0;
			for (int i = 0; i < s % c; ++i)
				sum += (n + 1) * (n + 1);
			for (int i = 0; i < c - s % c; ++i)
				sum += n * n;
			cout << sum << endl;
		}
	}
	return 0;
}

//int n, m, x, y;
//int flag = 0;
//char mp[501][501];
//bool vis[501][501];
//int dir[4][2] = { {1,0},{0,1},{-1,0},{0,-1} };
//void dfs(int x, int y)
//{
//	vis[x][y] = 1;
//	if (mp[x][y] == 'e')
//	{
//		flag = 1;
//		return;
//	}
//	else
//	{
//		for (int i = 0; i < 4; ++i)
//		{
//			int dx = x + dir[i][0];
//			int dy = y + dir[i][1];
//			if (dx < 0 || dy < 0 || dx >= n || dy >= m || mp[dx][dy] == '#' || vis[dx][dy] == 1)
//				continue;
//			dfs(dx, dy);
//			if (flag == 1)
//				break;
//		}
//	}
//	return;
//}
//int main()
//{
//	while (cin >> n >> m)
//	{
//		memset(vis, 0, sizeof(vis));
//		flag = 0;
//		for (int i = 0; i < n; ++i)
//			cin >> mp[i];
//		for (int i = 0; i < n; ++i)
//			for (int j = 0; j < m; ++j)
//				if (mp[i][j] == 's')
//				{
//					dfs(i, j);
//					break;
//				}
//		if (flag)
//			cout << "yes" << endl;
//		else
//			cout << "no" << endl;
//	}
//	return 0;
//}


#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<cstdio>
#include<math.h>
#include<memory.h>
#include<map>
#pragma warning(disable:4996)
#define maxn 0x7fffffff;
using namespace std;
typedef long long ll;
int gcd(int m, int n)
{
	return n ? gcd(n, m % n) : m;
}
bool cmp(int a, int b)
{
	return a > b;
}
int prime(int n)
{
	int flag = 0;
	for (int i = 2; i <= sqrt(n * 1.00); ++i)
	{
		if (n % i == 0)
		{
			flag = 1;
			return 1;
		}
	}
	if (flag == 0)
		return 0;
}
void swap(int a, int b)
{
	int t = a;
	a = b;
	b = t;
}
int pail(int m)
{
	int sum = 0;
	int n = m;
	while (m)
	{
		sum = sum * 10 + m % 10;
		m /= 10;
	}
	if (n == sum)
		return 1;
	else
		return 0;
}
map<int, int> v;
int main()
{
	int t;
	cin >> t;
	while (t--)
	{
		int c, s;
		cin >> c >> s;
		if (c >= s)
			cout << s * s << endl;
		else if (s%c==0)
			cout << (s/c) * (s/c)*c << endl;
		else
		{
			int n = s / c;
			int sum = 0;
			for (int i = 0; i < s % c; ++i)
				sum += (n + 1) * (n + 1);
			sum += c - s % c;
			cout << sum << endl;
		}
	}
	return 0;
}

//int n, m, x, y;
//int flag = 0;
//char mp[501][501];
//bool vis[501][501];
//int dir[4][2] = { {1,0},{0,1},{-1,0},{0,-1} };
//void dfs(int x, int y)
//{
//	vis[x][y] = 1;
//	if (mp[x][y] == 'e')
//	{
//		flag = 1;
//		return;
//	}
//	else
//	{
//		for (int i = 0; i < 4; ++i)
//		{
//			int dx = x + dir[i][0];
//			int dy = y + dir[i][1];
//			if (dx < 0 || dy < 0 || dx >= n || dy >= m || mp[dx][dy] == '#' || vis[dx][dy] == 1)
//				continue;
//			dfs(dx, dy);
//			if (flag == 1)
//				break;
//		}
//	}
//	return;
//}
//int main()
//{
//	while (cin >> n >> m)
//	{
//		memset(vis, 0, sizeof(vis));
//		flag = 0;
//		for (int i = 0; i < n; ++i)
//			cin >> mp[i];
//		for (int i = 0; i < n; ++i)
//			for (int j = 0; j < m; ++j)
//				if (mp[i][j] == 's')
//				{
//					dfs(i, j);
//					break;
//				}
//		if (flag)
//			cout << "yes" << endl;
//		else
//			cout << "no" << endl;
//	}
//	return 0;
//}


#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<cstdio>
#include<math.h>
#include<memory.h>
#include<map>
#pragma warning(disable:4996)
#define maxn 0x7fffffff;
using namespace std;
typedef long long ll;
int gcd(int m, int n)
{
	return n ? gcd(n, m % n) : m;
}
bool cmp(int a, int b)
{
	return a > b;
}
int prime(int n)
{
	int flag = 0;
	for (int i = 2; i <= sqrt(n * 1.00); ++i)
	{
		if (n % i == 0)
		{
			flag = 1;
			return 1;
		}
	}
	if (flag == 0)
		return 0;
}
void swap(int a, int b)
{
	int t = a;
	a = b;
	b = t;
}
int pail(int m)
{
	int sum = 0;
	int n = m;
	while (m)
	{
		sum = sum * 10 + m % 10;
		m /= 10;
	}
	if (n == sum)
		return 1;
	else
		return 0;
}
map<int, int> v;
int main()
{
	int t;
	cin >> t;
	while (t--)
	{
		int c, s;
		cin >> c >> s;
		if (c >= s)
			cout << s * s;
		else if (s%c==0)
			cout << (s/c) * (s/c)*c << endl;
		else
		{
			int n = s / c;
			int sum = 0;
			for (int i = 0; i < s % c; ++i)
				sum += (n + 1) * (n + 1);
			sum += c - s % c;
			cout << sum << endl;
		}
	}
	return 0;
}

//int n, m, x, y;
//int flag = 0;
//char mp[501][501];
//bool vis[501][501];
//int dir[4][2] = { {1,0},{0,1},{-1,0},{0,-1} };
//void dfs(int x, int y)
//{
//	vis[x][y] = 1;
//	if (mp[x][y] == 'e')
//	{
//		flag = 1;
//		return;
//	}
//	else
//	{
//		for (int i = 0; i < 4; ++i)
//		{
//			int dx = x + dir[i][0];
//			int dy = y + dir[i][1];
//			if (dx < 0 || dy < 0 || dx >= n || dy >= m || mp[dx][dy] == '#' || vis[dx][dy] == 1)
//				continue;
//			dfs(dx, dy);
//			if (flag == 1)
//				break;
//		}
//	}
//	return;
//}
//int main()
//{
//	while (cin >> n >> m)
//	{
//		memset(vis, 0, sizeof(vis));
//		flag = 0;
//		for (int i = 0; i < n; ++i)
//			cin >> mp[i];
//		for (int i = 0; i < n; ++i)
//			for (int j = 0; j < m; ++j)
//				if (mp[i][j] == 's')
//				{
//					dfs(i, j);
//					break;
//				}
//		if (flag)
//			cout << "yes" << endl;
//		else
//			cout << "no" << endl;
//	}
//	return 0;
//}


#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<cstdio>
#include<math.h>
#include<memory.h>
#include<map>
#pragma warning(disable:4996)
#define maxn 0x7fffffff;
using namespace std;
typedef long long ll;
int gcd(int m, int n)
{
	return n ? gcd(n, m % n) : m;
}
bool cmp(int a, int b)
{
	return a > b;
}
int prime(int n)
{
	int flag = 0;
	for (int i = 2; i <= sqrt(n * 1.00); ++i)
	{
		if (n % i == 0)
		{
			flag = 1;
			return 1;
		}
	}
	if (flag == 0)
		return 0;
}
void swap(int a, int b)
{
	int t = a;
	a = b;
	b = t;
}
int pail(int m)
{
	int sum = 0;
	int n = m;
	while (m)
	{
		sum = sum * 10 + m % 10;
		m /= 10;
	}
	if (n == sum)
		return 1;
	else
		return 0;
}
map<int, int> v;
int main()
{
	int t;
	cin >> t;
	while (t--)
	{
		int c, s;
		cin >> c >> s;
		if (c >= s)
			cout << s  << endl;
		else if (c == s)
			cout << s << endl;
		else if (s%c==0)
			cout << (s/c) * (s/c)*c << endl;
		else
		{
			int n = s / c;
			int sum = 0;
			for (int i = 0; i < s % c; ++i)
				sum += (n + 1) * (n + 1);
			for (int i = 0; i < c - s % c; ++i)
				sum += n * n;
			cout << sum << endl;
		}
	}
	return 0;
}

//int n, m, x, y;
//int flag = 0;
//char mp[501][501];
//bool vis[501][501];
//int dir[4][2] = { {1,0},{0,1},{-1,0},{0,-1} };
//void dfs(int x, int y)
//{
//	vis[x][y] = 1;
//	if (mp[x][y] == 'e')
//	{
//		flag = 1;
//		return;
//	}
//	else
//	{
//		for (int i = 0; i < 4; ++i)
//		{
//			int dx = x + dir[i][0];
//			int dy = y + dir[i][1];
//			if (dx < 0 || dy < 0 || dx >= n || dy >= m || mp[dx][dy] == '#' || vis[dx][dy] == 1)
//				continue;
//			dfs(dx, dy);
//			if (flag == 1)
//				break;
//		}
//	}
//	return;
//}
//int main()
//{
//	while (cin >> n >> m)
//	{
//		memset(vis, 0, sizeof(vis));
//		flag = 0;
//		for (int i = 0; i < n; ++i)
//			cin >> mp[i];
//		for (int i = 0; i < n; ++i)
//			for (int j = 0; j < m; ++j)
//				if (mp[i][j] == 's')
//				{
//					dfs(i, j);
//					break;
//				}
//		if (flag)
//			cout << "yes" << endl;
//		else
//			cout << "no" << endl;
//	}
//	return 0;
//}


#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<cstdio>
#include<math.h>
#include<memory.h>
#include<map>
#pragma warning(disable:4996)
#define maxn 0x7fffffff;
using namespace std;
typedef long long ll;
int gcd(int m, int n)
{
	return n ? gcd(n, m % n) : m;
}
bool cmp(int a, int b)
{
	return a > b;
}
int prime(int n)
{
	int flag = 0;
	for (int i = 2; i <= sqrt(n * 1.00); ++i)
	{
		if (n % i == 0)
		{
			flag = 1;
			return 1;
		}
	}
	if (flag == 0)
		return 0;
}
void swap(int a, int b)
{
	int t = a;
	a = b;
	b = t;
}
int pail(int m)
{
	int sum = 0;
	int n = m;
	while (m)
	{
		sum = sum * 10 + m % 10;
		m /= 10;
	}
	if (n == sum)
		return 1;
	else
		return 0;
}
map<int, int> v;
int main()
{
	int t;
	cin >> t;
	while (t--)
	{
		int c, s;
		cin >> c >> s;
		if (c >= s)
			cout << s * s << endl;
		else if (s%c==0)
			cout << (s/c) * (s/c)*c << endl;
		else
		{
			int n = s / c;
			int sum = 0;
			for (int i = 0; i < s % c; ++i)
				sum += (n + 1) * (n + 1);
			for (int i = 0; i < c - s % c; ++i)
				sum += n * n;
			cout << sum << endl;
		}
	}
	return 0;
}

//int n, m, x, y;
//int flag = 0;
//char mp[501][501];
//bool vis[501][501];
//int dir[4][2] = { {1,0},{0,1},{-1,0},{0,-1} };
//void dfs(int x, int y)
//{
//	vis[x][y] = 1;
//	if (mp[x][y] == 'e')
//	{
//		flag = 1;
//		return;
//	}
//	else
//	{
//		for (int i = 0; i < 4; ++i)
//		{
//			int dx = x + dir[i][0];
//			int dy = y + dir[i][1];
//			if (dx < 0 || dy < 0 || dx >= n || dy >= m || mp[dx][dy] == '#' || vis[dx][dy] == 1)
//				continue;
//			dfs(dx, dy);
//			if (flag == 1)
//				break;
//		}
//	}
//	return;
//}
//int main()
//{
//	while (cin >> n >> m)
//	{
//		memset(vis, 0, sizeof(vis));
//		flag = 0;
//		for (int i = 0; i < n; ++i)
//			cin >> mp[i];
//		for (int i = 0; i < n; ++i)
//			for (int j = 0; j < m; ++j)
//				if (mp[i][j] == 's')
//				{
//					dfs(i, j);
//					break;
//				}
//		if (flag)
//			cout << "yes" << endl;
//		else
//			cout << "no" << endl;
//	}
//	return 0;
//}


#include <bits/stdc++.h>
using namespace std;
int n,i,a,b;
int main()
{   ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin>>n;
    for (int i=1;i<=n;++i)
    {   cin>>a>>b;
        cout<<((b%a)*pow(b/a+1,2)+(b-(b%a))*(pow(b/a,2)));
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int n,i,a,b;
int main()
{   ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin>>n;
    for (int i=1;i<=n;++i)
    {   cin>>a>>b;
        if (b/a==0) cout<<b;
        else if (b%a==0) cout<<pow(b/a,2)*(b/a);
        else cout<<pow(b/a,2)*(b/a)+pow(b%a,2);
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int n,x,y;
int main()
{   //freopen("1260A.inp","r",stdin);
    //freopen("1260A.out","w",stdout);
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin>>n;
    while (n>0)
    {   cin>>x>>y; int t=y/x;
        cout<<t*t*(x-y%x)+(t+1)*(t+1)*(y%x)<<'\n';
        n--;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int n,i,a,b;
int main()
{   ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin>>n;
    for (int i=1;i<=n;++i)
    {   cin>>a>>b;
        cout<<((b%a)*pow(b/a+1,2)+(b-(b%a))*(pow(b/a,2)))<<'\n';
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int n,i,a,b;
int main()
{   ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin>>n;
    for (int i=1;i<=n;++i)
    {   cin>>a>>b;
        if (b/a==0) cout<<b;
        else if (a/b==0) cout<<(pow(b,2));
        else if (b%a==0) cout<<pow(b/a,2)*(b/a);
        else cout<<pow(b/a,2)*(b/a)+pow(b%a,2);
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int n,i,a,b;
int main()
{   ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin>>n;
    for (int i=1;i<=n;++i)
    {   cin>>a>>b;
        if (a/b==0) cout<<b;
        else cout<<pow(b/2,2)*pow(b/2,2)*pow(b%a,2);
    }
    return 0;
}