Harryxun/stf_run huggingface dataset:
N = int(input())
G = [[] for _ in range(N+1)]

for i in range(N-1):
    a, b = map(int, input().split())
    G[a].append((b, i))
    G[b].append((a, i))

color = max(len(g) for g in G)
print(color)

ans = [-1] * (N-1)

def dfs(v=1, p=0, p_col=-1):
    col = 1

    for side, idx in G[v]:
        if side != p:
            if col == p_col:
                col += 1
            ans[idx] = col
            dfs(side, v, col)
            col += 1

dfs()
print("\n".join(map(str, ans)))

### FIXED CODE ###

import sys
sys.setrecursionlimit(500000)

N = int(input())
G = [[] for _ in range(N+1)]

for i in range(N-1):
    a, b = map(int, input().split())
    G[a].append((b, i))
    G[b].append((a, i))

color = max(len(g) for g in G)
print(color)

ans = [-1] * (N-1)

def dfs(v=1, p=0, p_col=-1):
    col = 1

    for side, idx in G[v]:
        if side != p:
            if col == p_col:
                col += 1
            ans[idx] = col
            dfs(side, v, col)
            col += 1

dfs()
print("\n".join(map(str, ans)))
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import functools

input = sys.stdin.readline
n, x = map(int, input().split())
a = input().split()
b = list(map(int, a))
b.append(x)
b.sort()
c = []
if len(b) == 2:
    print(b[1] - b[0])
    exit(0)
for i in range(1, n - 1):
    c.append(b[i] - b[i - 1])


def gcd(a, b):
    while b > 0:
        a, b = b, a % b
    return a

ans = functools.reduce(gcd, c)
print(ans)


### FIXED CODE ###

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys

input = sys.stdin.readline
n, x = map(int, input().split())
a = input().split()
b = list(map(int, a))
b.append(x)
b.sort()
if len(b) == 2:
    print(b[1] - b[0])
    exit(0)
c = [abs(a - x) for a in b]


def gcd(a, b):
    while b > 0:
        a, b = b, a % b
    return a


ans = c[0]
for i in range(len(c)):
    ans = gcd(c[i], ans)
print(ans)
def main():
N=int(input())
A=list(map(int,input().split()))
if A is 0:
  print(0)
  return
p=1
for i in A:
  p=p*i
  if p>1000000000000000000:
    print(-1)
    return
print(p)  
main()  
  


### FIXED CODE ###

def main():
    N=int(input())
    A=list(map(int,input().split()))
    if 0 in A:
      print('0')
      return
    p=1
    for i in A:
      p=p*i
      if p>1000000000000000000:
        print(-1)
        return
    print(p)    
main()
N=int(input())
X=[int(i) for _ in input().split())]

Y=sorted(X)

a1=Y[N//2]
a2=Y[N//2-1]

for i in range(N):
    if X[i]<=a1:
        print(a1)
    else:
        print(a2)

### FIXED CODE ###

N=int(input())
X=[int(i) for i in input().split()]

Y=sorted(X)

a1=Y[N//2-1]
a2=Y[N//2]

for i in range(N):
    if X[i]<=a1:
        print(a2)
    else:
        print(a1)
n=int(input())
a=(int(x) for x in input().split())
a.sort(reverse=True)
alice=0
bob=0
for i in range(0,n,2):
  alice+=a[i]
for i in range(1,n,2):
  bob+=a[i]
print(alice-bob)

### FIXED CODE ###

n=int(input())
a=[int(x) for x in input().split()]
a.sort(reverse=True)
alice=0
bob=0
for i in range(0,n,2):
  alice+=a[i]
for i in range(1,n,2):
  bob+=a[i]
print(alice-bob)
N,Q = list(map(int,input().split()))
S = (input())
lr = [list(map(int,input().split())) for _ in range(Q)]

cnt = [0]*N
tmp = 0
for i,c in enumerate(S):
    if tmp == 0 and c == "A":
        tmp =1
        cnt[i] = cnt[i-1]
    elif tmp == 1 and c == "C":
        tmp =0
        cnt[i] = cnt[i-1]+1
    else:
        tmp = int(c == "A")
        cnt[i] = cnt[i-1]

for l,r in lr:
    print(cnt[r-1]-cnt[l-1] , " : " ,S[l-1:r])

### FIXED CODE ###

N,Q = list(map(int,input().split()))
S = (input())
lr = [list(map(int,input().split())) for _ in range(Q)]

cnt = [0]*N
tmp = 0
for i,c in enumerate(S):
    if tmp == 0 and c == "A":
        tmp =1
        cnt[i] = cnt[i-1]
    elif tmp == 1 and c == "C":
        tmp =0
        cnt[i] = cnt[i-1]+1
    else:
        tmp = int(c == "A")
        cnt[i] = cnt[i-1]

for l,r in lr:
    print(cnt[r-1]-cnt[l-1])
import math
a,b,c,d,e,f = map(int,input().split())
max_sugar = f*e*100/(100+e)
box = {}
for i in range(31):
  for j in range(31):
    water = 100*a*i + 100*b*j
    if water > f:
      break
    sugar_range = int(math.ceil(max_sugar/c))
    for k in range(sugar_range):
      for l in range(sugar_range):
        sugar = c*k + d*l
        if sugar > max_sugar:
          break
        amount = water + sugar
        if amount > f or amount == 0
          break
        conc = 100*sugar / amount
        if conc <= e*100/(100+e):
          box[conc] = [amount,sugar]
answer = max(box.items(),key = lambda x:x[0])[1]
print(str(answer[0]) + " " +str(answer[1]))

### FIXED CODE ###

import math
a,b,c,d,e,f = map(int,input().split())
max_nodo = e/(e+100)
answer = {}
for i in range(31):
  for j in range(31):
    water = 100*a*i + 100*b*j
    max_sugar = water*e/100
    sugar_range = int(math.ceil(max_sugar/c))
    if water >= f:
      break
    for k in range(sugar_range):
      for l in range(sugar_range):
        sugar = c*k + d*l
        total = water + sugar
        nodo = sugar / total
        if total > f:
          break
        if sugar > max_sugar:
          break
        answer[nodo] = [total,sugar]
ans = max(answer.items(),key = lambda x:x[0])[1]

#print(answer)
print(str(ans[0]) + " " + str(ans[1]))
a, b = map(int , input().split())
print(a*b)

### FIXED CODE ###

i = list(input().split())
a = int(i[0]);
b = int(i[1][:1] + i[1][2:])
print(a*b // 100)
A, B = map(int, input().split())
print(max(0, A-B*2)

### FIXED CODE ###

A, B = map(int, input().split())
print(max(0, A-B*2))
n = int(input())
from itertools import product
ans = 0
for i in range(1, 11):
  for p in product("357", repeat=i):
    v = "".join(p)
    if "3" in v and "5" in v and "7" in v and int("".join(p)) <= N:
      ans += 1
print(ans)

### FIXED CODE ###

n = int(input())
from itertools import product
ans = 0
for i in range(1, 11):
  for p in product("357", repeat=i):
    v = "".join(p)
    if "3" in v and "5" in v and "7" in v and int("".join(p)) <= n:
      ans += 1
print(ans)
a,b = input(),split()
a = int(a)
b = int(b)
price = 0
if(a>=13):
  price = b
if(a>=6):
  price = b / 2
print(price)

### FIXED CODE ###

a,b = input().split()
a = int(a)
b = int(b)
price = 0
if a>=13:
    price = b
elif a>=6:
    price = b / 2
else:
    price = 0
price = int(price)
print(price)
def test():
    s = input()
    divide = ["dream", "dreamer", "erase", "eraser"]
    dp = [0 for i in range(10010)]

    dp[0] = 1
    for i in range(len(dp)):
        if dp[len(s)] == 1:
            print('YES')
            return 0
        if dp[i] == 0:
            continue
        for d in divide:
            if s[i:i+len(d)] == d:
                dp[i+len(d)] = 1
                print(i+len(d))
    print('NO')

test()

### FIXED CODE ###

def test():
    s = input()
    divide = ["dream", "dreamer", "erase", "eraser"]
    dp = [0 for i in range(100010)]

    dp[0] = 1
    for i in range(len(dp)):
        if dp[len(s)] == 1:
            print('YES')
            return 0
        if dp[i] == 0:
            continue
        for d in divide:
            if s[i:i+len(d)] == d:
                dp[i+len(d)] = 1
    print('NO')

test()
# -*- coding: utf-8 -*-

import numpy as np

N = int(input())

A = np.arrya(list(map(int, input().split())))
mul = np.prod(A)

if mul > 1000000000000000000:
    print(-1)
    exit(-1)
print(mul)

### FIXED CODE ###

# -*- coding: utf-8 -*-

import numpy as np

N = int(input())

A = np.array(list(map(int, input().split())))

if 0 in A:
    print(0)
    exit(0)

mul = A[0]

if np.sum(A < 0) % 2 == 1:
    for i in A[1:]:
        mul *= i
else:
    for i in A[1:]:
        if 1000000000000000000 / i < mul:
            print(-1)
            exit(0)
        mul *= i

if mul > 1000000000000000000:
    print(-1)
    exit(0)

print(mul)
a, b = map(float, input().split())
attack_list = list(map(float, input().split()))

if(a <= sum(attack_list)):
    print("Yes")
else:
    print("No")

### FIXED CODE ###

import math
a, b = map(float, input().split())
x = a / b
if (x.is_integer() == False):
    print(math.ceil(x))
else:
    print(int(x))
get=input()
get = get.split(" ")
flg=0
get=list(set(get))
for a in :
  if int(a) in[1,9,7,4]:
    flg+=1
    
if flg==4:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

get=input()
get = get.split(" ")
flg=0
get=list(set(get))
for a in get:
  if int(a) in[1,9,7,4]:
    flg+=1
    
if flg==4:
  print("YES")
else:
  print("NO")
import sys


def process():
    for data in get_dataset():
        H = len(data)
        W = len(data[0])
        field = create_field(H, W)
        print search(H, W, data, field)


def search(H, W, data, field):
    count = 0
    for i in xrange(H):
        for j in xrange(W):
            if field[i][j] == 0:
                continue
            _search(i, j, H, W, data[i][j], data, field)
            count += 1
    return count


def _search(i, j, H, W, cell, data, field):
    field[i][j] = 0
    for a in xrange(i-1, i+2):
        if -1 < a < H:
            pass
        else:
            continue
        for b in xrange(j-1, j+2):
            if -1 < b < W:
                pass
            else:
                continue

            if a != i and b != j:
                continue

            if field[a][b] == 0:
                continue
            if cell == data[a][b]:
                _search(a, b, H, W, cell, data, field)
    return


def create_field(H, W):
    field = []
    for i in xrange(H):
        raw = []
        for j in xrange(W):
            raw.append(1)
        field.append(raw)
    return field


def get_dataset():
    dataset = []
    while True:
        line = raw_input().rstrip().split()
        H = int(line[0])
        if H == 0:
            break

        data = []
        for i in xrange(H):
            data.append(raw_input().rstrip())
        dataset.append(data)
    return dataset

process()

### FIXED CODE ###

import sys
sys.setrecursionlimit(100000000)


def main():
    solve()


def solve():
    for data in get_dataset():
        print search(data)


def search(data):
    count = 0
    H = len(data)
    W = len(data[0])
    for i in xrange(H):
        for j in xrange(W):
            if data[i][j] == '.':
                continue
            _search(i, j, H, W, data[i][j], data)
            count += 1
    return count


def _search(i, j, H, W, cell, data):
    data[i][j] = '.'
    for a in xrange(i-1, i+2):
        if not -1 < a < H:
            continue
        for b in xrange(j-1, j+2):
            if not -1 < b < W:
                continue

            if a != i and b != j:
                continue

            if data[a][b] == '.':
                continue

            if cell == data[a][b]:
                _search(a, b, H, W, cell, data)
    return


def get_dataset():
    dataset = []
    while True:
        line = raw_input().rstrip().split()
        H = int(line[0])
        if H == 0:
            break

        data = []
        for i in xrange(H):
            data.append(list(raw_input().rstrip()))
        dataset.append(data)
    return dataset


if __name__ == '__main__':
    main()
from functools import reduce
from fractions import gcd
import heapq
import queue
import math
import bisect
import itertools
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
INF = float("inf")


def main():
    H, W = map(int, input().split())
    G = []
    for _ in range(H):
        G.append(list(input()[:-1]))
    
    C = [[INF] * W for _ in range(H)]
    C[0][0] = 1
    cnt = 0
    for i in range(H):
        for j in range(W):
            if G[i][j] == "#":
                cnt += 1
                continue
            if i + 1 < H:
                C[i+1][j] = min(C[i+1][j], C[i][j] + 1)
            if j + 1 < W:
                C[i][j+1] = min(C[i][j+1], C[i][j] + 1)

    if C[H-1][W-1] == INF or G[H-1][G-1] == "#":
        print(-1)
    else:
        print(H * W - (C[H-1][W-1] + cnt))


if __name__ == '__main__':
    main()

### FIXED CODE ###

from collections import deque
import sys
input = sys.stdin.readline
INF = float('inf')

def main():
    def bfs(x, y):
        L = [[INF]*W for _ in range(H)]
        L[0][0] = 1
        Q = deque([[0,0]])
        while len(Q)!=0:
            x, y = Q.popleft()
            if x==W-1 and y==H-1:
                break
            for i in range(4):
                nx, ny = x + [1,0,-1,0][i], y + [0,1,0,-1][i]
                if 0<=nx and nx<W and 0<=ny and ny<H:
                    if M[ny][nx]=='.' and L[ny][nx]==INF:
                        Q.append([nx, ny])
                        L[ny][nx] = L[y][x] + 1
        return L[H-1][W-1]
    
    H, W = map(int, input().split())
    M = []
    cnt = 0
    for _ in range(H):
        m = list(input()[:-1])
        cnt += m.count('#')
        M.append(m)

    b = bfs(0, 0)
    if b==INF:
        print(-1)
    else:
        print(H*W - cnt - b)


if __name__ == '__main__':
    main()
import sys
sys.setrecursionlimit(10000000)

N = int(input())
A = {}
B = {}
ABsa = {}
BAsa = {}
noneqqs = []
cnt = 0
aeqq_cnt = 0
beqq_cnt = 0

for i in range(N):
	a,b = map(int,input().split())
	A[i] = a
	B[i] = b
	ABsa[i] = a-b
	BAsa[i] = b-a
	if(a==b):
		cnt += 1
	elif(a!=b):
		noneqqs.append(i)
	if(A[0]==a):
		aeqq_cnt += 1
	if(B[0]==b):
		beqq_cnt += 1

takahashi = 0
aoki = 0
if(cnt == N):
	for j in range(N):
		if(j%2 == 0):
			maxkey = max(A,key=A.get)
			takahashi += int(A[maxkey])
			del A[maxkey]
			del B[maxkey]

		elif(j%2 == 1):
			maxkey2 = max(B,key=B.get)
			aoki += int(B[maxkey2])
			del B[maxkey2]
			del A[maxkey2]
	print(takahashi-aoki)

elif(aeqq_cnt == N):
	for j in range(N):
		if(j%2 == 0):
			maxkey = max(B,key=B.get)
			takahashi += int(A[maxkey])
			del A[maxkey]
			del B[maxkey]
		elif(j%2 == 1):
			maxkey2 = max(B, key=B.get)
			aoki += int(B[maxkey2])
			del B[maxkey2]
			del A[maxkey2]
	print(takahashi-aoki)

elif(beqq_cnt == N):
	for j in range(N):
		if(j%2 == 0):
			maxkey = max(A,key=A.get)
			takahashi += int(A[maxkey])
			del A[maxkey]
			del B[maxkey]
		elif(j%2 == 1):
			maxkey2 = max(A, key=A.get)
			aoki += int(B[maxkey2])
			del B[maxkey2]
			del A[maxkey2]
	print(takahashi-aoki)

else:
	for j in range(N):
		if(j%2 == 0):
			maxkey = max(BAsa,key=BAsa.get)
			takahashi += int(A[maxkey])
			del A[maxkey]
			del B[maxkey]
		elif(j%2 == 1):
			maxkey2 = max(ABsa, key=ABsa.get)
			aoki += int(B[maxkey2])
			del B[maxkey2]
			del A[maxkey2]
	print(takahashi-aoki)


### FIXED CODE ###

import sys
sys.setrecursionlimit(10000000)

N = int(input())
A = {}
B = {}
AplusB =[]

for i in range(N):
	a,b = map(int,input().split())
	A[i] = a
	B[i] = b
	AplusB.append((a+b,i))

AplusB.sort()
AplusB.reverse()


takahashi = 0
aoki = 0

for j in range(N):
	if(j%2 == 0):
		takahashi += A[AplusB[j][1]]
	else:
		aoki += B[AplusB[j][1]]

print(takahashi-aoki)
def get_next_ints(delim=" "):
    return tuple([int(float(x)) for x in input().split(delim)])

def get_next_by_types(*value_types,delim=" "):
    """標準入力をスペースで分割し、それぞれを任意のタイプにcastします
    row, col, text = get_next_by_types(int, int ,str)
    """
    return tuple([t(x) for t, x in zip(value_types,input().rstrip("\n").split(delim))])

def main():
    n, m = get_next_ints()
    ac_count = 0
    wa_count = 0
    
    ac_found = False
    wa = 0
    prev_p = -1
    for i in range(m):
        
        p, result = get_next_by_types()
        if p != prev_p:
            prev_p = p
            if ac_found:
                ac_count += 1
                wa_count += wa
            ac_found = False
            wa = 0
        if not ac_found:
            if result == 'AC':
                ac_found = True
            else:
                wa += 1
    if ac_found:
        ac_count += 1
        wa_count += wa
    print(ac_count, wa_count)
    
if __name__ == '__main__':
    main()
if __name__ == '__jupyter__':
    import doctest
    print(doctest.testmod())


### FIXED CODE ###

def get_next_ints(delim=" "):
    return tuple([int(float(x)) for x in input().split(delim)])


def get_next_by_types(*value_types, delim=" "):
    return tuple(
        [t(x) for t, x in zip(value_types, input().rstrip("\n").split(delim))])


def main():
    n, m = get_next_ints()
    ac_count = 0
    wa_count = 0

    from collections import defaultdict
    ac_cache = defaultdict(int)
    wa_cache = defaultdict(int)
    ac_count = 0
    wa_count = 0
    wa = 0
    for i in range(m):

        p, result = get_next_by_types(int, str)

        if ac_cache[p] == 0:
            if result == 'AC':

                ac_cache[p] = 1
                ac_count += 1
                wa_count += wa_cache[p]
                wa = 0
            else:
                wa_cache[p] += 1
    print(ac_count, wa_count)


if __name__ == '__main__':
    main()
if __name__ == '__jupyter__':
    import doctest
    print(doctest.testmod())
a,b = int(input()), int(input())

print('GREATER' if a>b or 'LESS')

### FIXED CODE ###

a,b = int(input()), int(input())

if a > b:
    print('GREATER')
elif a < b:
    print('LESS')
else:
    print('EQUAL')
a,b,c,k = (int(x) for x in input().split())
answer = 0
answer += min(a,k)
k = k - min(a,k)
k = k - min(b-k)
answer -= min(c,k)
print(answer)

### FIXED CODE ###

a,b,c,k = (int(x) for x in input().split())
answer = 0
answer += min(a,k)
k = k - min(a,k)
k = k - min(b,k)
answer -= min(c,k)
print(answer)
class UnionFindWithRank:
    # par: 親の番号(はじめ par[i]==i つまりすべての頂点が根)
    def __init__(self, size:int):
        self.par = [-1]*size
        self.rank = [0]*size
        for i in range(size):
            self.par[i] = i
    
    def root(self, x:int)->int:
        """根を求める"""
        if self.par[x] == x: # if root
            return x
        else:
            self.par[x] = self.root(self.par[x]) # 経路圧縮
            return self.par[x]
        
    def isSame(self, x:int, y:int)->bool:
        """x と y が同じ集合に属するか否か"""
        return self.root(x)==self.root(y)
    
    def unite(self, x:int, y:int):
        """x と y の属する集合を併合"""
        root_x = self.root(x)
        root_y = self.root(y)
        if root_x == root_y: return
        
        # 短いほうを長いほうにくっつける
        if self.rank[root_x] < self.rank[root_y]:
            self.par[root_x] = root_y
        else:
            self.par[root_y] = root_x
            if self.rank[root_x] == self.rank[root_y]:
                self.rank[root_x] += 1
                

##### main #####
N,M = map(int, input().split())
a,b = [0]*M, [0]*M
for i in range(M):
    ai,bi = map(int, input().split())
    a[i],b[i] = ai-1, bi-1
    
ans = 0
for i in range(M):
    uf = UnionFind(N)
    for j in range(M):
        if i==j: continue # この辺はパス
        uf.unite(a[j], b[j])
    bridge = False
    for i in range(N):
        if not uf.isSame(0,i):
            bridge = True
    if bridge:
        ans += 1
print(ans)

### FIXED CODE ###

# C
N,M = map(int, input().split())
graph = [[False]*N for _ in range(N)]
visited = [False]*N

def dfs(cur):
    global visited
    visited[cur] = True
    for nxt in range(N):
        if graph[cur][nxt]==False: continue
        if visited[nxt]==True: continue
        dfs(nxt)


a = [-1]*M
b = [-1]*M
for i in range(M):
    ai,bi = map(int, input().split())
    a[i],b[i] = ai-1, bi-1
    graph[a[i]][b[i]] = True
    graph[b[i]][a[i]] = True

ans = 0
for i in range(M):
    graph[a[i]][b[i]] = False # 辺を消す
    graph[b[i]][a[i]] = False
    # print("graph: "+"\n".join(map(str, graph)))
    visited = [False]*N
    dfs(0)
    if not all(visited):
        ans += 1
    graph[a[i]][b[i]] = True # 辺を戻す
    graph[b[i]][a[i]] = True
    
print(ans)
import sys


#torf = [[None for _ in range(m)]for _ in range(n)]
#print(torf)
#print(torf[0][0])
#print(torf[1][0])

s = input()
ans =""

if s[0]=="?":
    if s[1]=="D":
        ans = ans+"P"
    else:
        ans = ans + "D"
else :
    ans = ans + s[0]

for i in range(1,len(s)):
    if s[i]=="?":
        if ans[i-1]=="P":
            ans = ans + "D"
        else:
            ans = ans + "P"
    else:
        ans = ans + s[i]
    

print(ans)


### FIXED CODE ###

import sys


#torf = [[None for _ in range(m)]for _ in range(n)]
#print(torf)
#print(torf[0][0])
#print(torf[1][0])

s = input()
ans =""
if len(s)==1:
    if s[0]=="?":
        print("D")
        sys.exit()
    else:
        print(s[0])
        sys.exit()

if s[0]=="?":
    if s[1]=="D" or s[1]=="?":
        ans = ans+"P"
    else:
        ans = ans + "D"
else :
    ans = ans + s[0]

for i in range(1,len(s)):
    if s[i]=="?":
        if ans[i-1]=="P":
            ans = ans + "D"
        elif ans[i-1]=="D":
            if i<len(s)-1:
                if s[i+1]=="P":
                    ans = ans + "D"
                else:
                    ans= ans + "P"
            else:
                ans = ans + "D"
        else:
            ans = ans + "P"    
    else:
        ans = ans + s[i]
    

print(ans)
N = int(input())
while N > 0:
    if N % 4 == 0 or N % 7 == 0:
        flag = True
        break
    else:
        N -= 7
if flag == True:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

flag = False
N = int(input())
while N > 0:
    if N % 4 == 0 or N % 7 == 0:
        flag = True
        break
    else:
        N -= 7
if flag == True:
    print("Yes")
else:
    print("No")
n = int(input())
xyhn = [None] * n
for i in range(n):
    xyhn[i] = list(map(int, input().split(' ')))

def calc_h(cx, cy, xyh):
    return xyh[2] + abs(cx - xyh[0]) + abs(cy - xyh[1])

base = -1
for i in range(n):
    if xyhn[i][2] != 0:
        base = i
        break

ans = None
for cx in range(0, 101):
    for cy in range(0, 101):
        result = True
        tmp_h = calc_h(cx, cy, xyhn[base])
        for k in range(1, n):
            if tmp_h != calc_h(cx, cy, xyhn[k]):
                result = False
                break
        if result:
            ans = [cx, cy, calc_h(cx, cy, xyhn[base])]
            break

print(' '.join(map(str, list(ans))))



### FIXED CODE ###

n = int(input())
xyhn = [None] * n
for i in range(n):
    xyhn[i] = list(map(int, input().split(' ')))

def calc_h(cx, cy, xyh):
    return xyh[2] + abs(cx - xyh[0]) + abs(cy - xyh[1])

base = -1
for i in range(n):
    if xyhn[i][2] != 0:
        base = i
        break

ans = None
for cx in range(0, 101):
    for cy in range(0, 101):
        result = True
        tmp_h = calc_h(cx, cy, xyhn[base])
        for k in range(n):
            if xyhn[k][2] > 0 and tmp_h != calc_h(cx, cy, xyhn[k]):
                result = False
                break
            if xyhn[k][2] == 0 and abs(cx - xyhn[k][0]) + abs(cy - xyhn[k][1]) < tmp_h:
                result = False
                break
        if result:
            ans = [cx, cy, calc_h(cx, cy, xyhn[base])]
            break

print(' '.join(map(str, list(ans))))
n, x = map(int, input().split())
l = [int(i) for i in input().split()] 

d = 0
i = 0
if x > 0:
    while d <= x:
        d = d + l[i]
        i = i + 1
    print(i)
elif x <= 0:
    print(1)

### FIXED CODE ###

n, x = map(int, input().split())
l = [int(i) for i in input().split()] 

d = 0
i = 0
if x > 0:
    while d <= x:
        d = d + l[i]
        i = i + 1
        if i >= n:
            break
    if d > x:
        print(i)
    elif d <= x:
        print(n+1)
elif x <= 0:
    print(1)
def main():
    import sys
    def input(): return sys.stdin.readline().rstrip()
    n,m = map(int, input().split())
    if n%2 == 0
        for i in range(m):
            print(n//2-i,n//2+i)
    else:
        for i in range(m):
            print(n//2-i,n//2+i+2)



if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    import sys
    def input(): return sys.stdin.readline().rstrip()
    n,m = map(int, input().split())
    r = m//2
    s = 1
    e = 2*r+1
    for _ in range(r):
        print(s,e)
        s += 1
        e -=1
    
    s = n-2*(m-r)+1
    e = n
    for _ in range(m-r):
        print(s,e)
        s += 1
        e -=1


if __name__ == '__main__':
    main()