You are going to hold a competition of one-to-one game called AtCoder Janken. (Janken is the Japanese name for Rock-paper-scissors.)N players will participate in this competition, and they are given distinct integers from 1 through N.
The arena has M playing fields for two players. You need to assign each playing field two distinct integers between 1 and N (inclusive).
You cannot assign the same integer to multiple playing fields.
The competition consists of N rounds, each of which proceeds as follows:
 - For each player, if there is a playing field that is assigned the player's integer, the player goes to that field and fight the other player who comes there.
 - Then, each player adds 1 to its integer. If it becomes N+1, change it to 1.
You want to ensure that no player fights the same opponent more than once during the N rounds.
Print an assignment of integers to the playing fields satisfying this condition.
It can be proved that such an assignment always exists under the constraints given.

-----Constraints-----
 - 1 \leq M
 - M \times 2 +1 \leq N \leq 200000

-----Input-----
Input is given from Standard Input in the following format:
N M

-----Output-----
Print M lines in the format below.
The i-th line should contain the two integers a_i and b_i assigned to the i-th playing field.
a_1 b_1
a_2 b_2
:
a_M b_M

-----Sample Input-----
4 1

-----Sample Output-----
2 3

Let us call the four players A, B, C, and D, and assume that they are initially given the integers 1, 2, 3, and 4, respectively.
 - The 1-st round is fought by B and C, who has the integers 2 and 3, respectively. After this round, A, B, C, and D have the integers 2, 3, 4, and 1, respectively.
 - The 2-nd round is fought by A and B, who has the integers 2 and 3, respectively. After this round, A, B, C, and D have the integers 3, 4, 1, and 2, respectively.
 - The 3-rd round is fought by D and A, who has the integers 2 and 3, respectively. After this round, A, B, C, and D have the integers 4, 1, 2, and 3, respectively.
 - The 4-th round is fought by C and D, who has the integers 2 and 3, respectively. After this round, A, B, C, and D have the integers 1, 2, 3, and 4, respectively.
No player fights the same opponent more than once during the four rounds, so this solution will be accepted.

Difficulty: interview

Starter code:

Solutions:
N,M=map(int,input().split())

if M%2==0:
  for i in range(M//2):
    print(i+1,M-i)
  for i in range(M//2):
    print(M+i+1,2*M-i+1)  
else:
  for i in range(M//2):
    print(i+1,M-i)
  for i in range(M//2+1):
    print(M+i+1,2*M-i+1)

def main():
    n, m = map(int, input().split())
    if n%2:
        for i in range(m):
            print(i+1, n-i)
    else:
        for i in range(m):
            if n-2*i-1 > n//2:
                print(i+1, n-i)
            else:
                print(i+1, n-i-1)

def __starting_point():
    main()
__starting_point()

n,m = list(map(int, input().split()))

if n % 2 == 1:
    for i in range(m):
        print("{} {}".format(2 + i, n - i))
else:
    for i in range(m):
        if i % 2 == 0:
            print("{} {}".format(int(n / 2 - i / 2), int(n / 2 + 1 + i / 2)))
        else:
            print("{} {}".format(int(2 + i // 2), int(n - i // 2)))

n,m=map(int,input().split())
#1とnがつながっているときのa,bの最短距離
def dist(a,b):
  return min(abs(a-b),n-abs(a-b))

a,b = n,1
S=set()
for i in range(m):
  distab = dist(a,b)
  #distabがnの半分のとき
  if 2*distab == n or distab in S:
    a -= 1
  print(a,b)
  S.add(distab)
  a -= 1
  b += 1


from itertools import count, permutations, chain
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
import sys
sys.setrecursionlimit(1000000000)
import math
from math import gcd
def lcm(a, b): return a * b // gcd(a, b)
ii = lambda: int(input())
mis = lambda: list(map(int, input().split()))
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok

def get_inv(n, modp):
    return pow(n, modp-2, modp)

def factorials_list(n, modp):    # 10**6
    fs = [1]
    for i in range(1, n+1):
        fs.append(fs[-1] * i % modp)
    return fs

def invs_list(n, fs, modp):     # 10**6
    invs = [get_inv(fs[-1], modp)]
    for i in range(n, 1-1, -1):
        invs.append(invs[-1] * i % modp)
    invs.reverse()
    return invs

def comb(n, k, modp):
    num = 1
    for i in range(n, n-k, -1):
        num = num * i % modp
    den = 1
    for i in range(2, k+1):
        den = den * i % modp
    return num * get_inv(den, modp) % modp

def comb_from_list(n, k, modp, fs, invs):   
    return fs[n] * invs[n-k] * invs[k] % modp

#

class UnionFindEx:
    def __init__(self, size):
        #正なら根の番号、負ならグループサイズ
        self.roots = [-1] * size
    def getRootID(self, i):
        r = self.roots[i]
        if r < 0:   #負なら根
            return i
        else:
            r = self.getRootID(r)
            self.roots[i] = r
            return r
    def getGroupSize(self, i):
        return -self.roots[self.getRootID(i)]
    def connect(self, i, j):
        r1, r2 = self.getRootID(i), self.getRootID(j)
        if r1 == r2:
            return False
        if self.getGroupSize(r1) < self.getGroupSize(r2):
            r1, r2 = r2, r1
        self.roots[r1] += self.roots[r2]    #サイズ更新
        self.roots[r2] = r1
        return True

Yes = 'Yes'
No = 'No'


def main():
    N, M = mis()
    if N&1:
        q = deque(list(range(M*2)))
        while q:
            print((q.popleft()+1, q.pop()+1))
    else:
        q1 = deque(list(range(N)))
        q2 = deque(list(range(N-1)))
        p1 = []
        while q1:
            p1.append((q1.popleft()+1, q1.pop()+1))
        p2 = []
        while len(q2)>=2:
            p2.append((q2.popleft()+1, q2.pop()+1))
        p2.reverse()
        for _ in range(M):
            print((*p1.pop()))
            p1, p2 = p2, p1


main()



N, M = (int(_) for _ in input().split())

if N % 2 == 0:
    s = (N - 1) // 4 + 1
    ret = []
    for i in range(1, s):
        ret.append((i, N - i))
    for i in range(s, N // 2):
        ret.append((i, N - i - 1))
else:
    ret = []
    for i in range(1, (N // 2) + 1):
        ret.append((i, N - i))


for r0, r1 in ret[:M]:
    print((r0, r1))


N, M = map(int, input().split())

if N % 2 == 1:
    for a in range(1, M + 1):
        print(a, N - a + 1)
else:
    for a in range(1, M + 1):
        if a <= N // 4:
            print(a, N - a + 1)
        else:
            print(a, N - a)

N, M = list(map(int, input().split()))

a = 1
b = 1+M

while(a < b) :
  print(a, b)
  a += 1
  b -= 1

a = M+2
b = 2*M+1
while(a < b) :
  print(a, b)
  a += 1
  b -= 1

def main():
    N, M = list(map(int, input().split()))  # N must be an odd number

    is_odd = (N-1) & 1
    bias = 0

    for i, distance in enumerate(range(N-1, 0, -2)):

        if is_odd and distance <= -distance % N:
            bias = 1

        left = i + 1
        right = left + distance - bias
        print((left, right))

        if i == M-1:
            return


def __starting_point():
    main()

__starting_point()

N,M = map(int,input().split())
ans = []
if N%2:
    for i in range(N//2):
        ans.append((i+1, N-1-i))
else:
    m = N//2
    for i in range(m//2):
        ans.append((i+1, m-i))
    for i in range((m-1)//2):
        ans.append((m+i+1, N-1-i))
for a,b in ans[:M]:
    print(a,b)

import sys
def main():
    N,M=tuple(map(int,sys.stdin.readline().split()))
    if M%2==1:
        m1,m2=M//2,M//2+1
        for i in range(m1):
            l,r=i+1,M-i
            print(str(l)+' '+str(r))
        for i in range(m2):
            l,r=M+1+i,2*M+1-i
            print(str(l)+' '+str(r))
    else:
        m=M//2
        for i in range(m):
            l,r=i+1,M+1-i
            print(str(l)+' '+str(r))
        for i in range(m):
            l,r=M+2+i,2*M+1-i
            print(str(l)+' '+str(r))
def __starting_point():main()
__starting_point()

n,m = map(int,input().split())
l=1
if n%2==1:
    r=n
    for i in range(m):
        d=min(abs(l-r),n-abs(l-r))
        print(l,r)
        l+=1
        r-=1
else:
    if n%4==0:
        r=n-1
    else:
        r=n
    rev=False
    for i in range(m):
        d=min(abs(l-r),n-abs(l-r))
        if d == n//2:
            rev=True
            l+=1
            print(l,r)
        else:
            print(l,r)
        l+=1
        r-=1

N,M=list(map(int, input().split()))
src=[i+1 for i in range(M*2+1)]
if M%2==0:
  for m in range(M//2):
    a=src[m]
    b=src[M-m]
    print('{} {}'.format(a,b))
  for m in range(M//2):
    a=src[M+1+m]
    b=src[-(m+1)]
    print('{} {}'.format(a,b))
else:
  for m in range(M//2):
    a=src[m]
    b=src[M-1-m]
    print('{} {}'.format(a,b))
  for m in range(M-(M//2)):
    a=src[M+m]
    b=src[-(m+1)]
    print('{} {}'.format(a,b))

def main():
    n, m = list(map(int, input().split()))
    left = 1
    right = n
    is_shift = False
    ans = []
    while left < right:
        if right - left <= n // 2 and not is_shift and n % 2 == 0:
            left += 1
            is_shift = True
        ans.append([left, right])
        left += 1
        right -= 1

    for l in range(m):
        print((*ans[l]))


def __starting_point():
    main()

__starting_point()

def main():
    N, M = list(map(int, input().split()))  # N must be an odd number

    left = 1
    count = 0
    buff = 0
    for d in range(N-1, 0, -2):

        if (N-1) & 1 and d <= -d % N:
            buff = 1

        right = left + d - buff
        print((left, right))

        left += 1
        count += 1
        if count == M:
            return


def __starting_point():
    main()

__starting_point()

import sys


def main():
    input = sys.stdin.buffer.readline
    N, M = list(map(int, input().split()))
    skip = (N // 2) // 2 + 1 if N % 2 == 0 else None
    count = 0
    left, right = 0, N + 1
    while count < M:
        left += 1
        if left == skip:
            continue
        right -= 1
        print((left, right))
        count += 1


def __starting_point():
    main()

__starting_point()

#E
import numpy as np
n, m = list(map(int, input().split()))
lists = list(np.arange(1, n+1))
list1 = lists[:m]
list2 = lists[m:]
num = m
for i in range(m//2 +1):
    if num == 0:
        break
    print(list2[i],list2[m+1-i-1])
    num -= 1
    if num == 0:
        break
    print(list1[i],list1[m-i-1])
    num -= 1

N, M = [int(_) for _ in input().split()]
l = 1
r = N
ans = []
for _ in range(M - M // 2):
    ans += [l, r]
    l += 1
    r -= 1
if (r - l) % 2 == (l + N - r) % 2:
    r -= 1
for _ in range(M // 2):
    ans += [l, r]
    l += 1
    r -= 1
ans = ans[:2 * M]
print(('\n'.join(f'{a} {b}' for a, b in zip(ans[::2], ans[1::2]))))


from collections import deque
from itertools import product
import sys
import math

sys.setrecursionlimit(200000)
input = sys.stdin.readline


def read():
    N, M = list(map(int, input().strip().split()))
    return N, M


def solve(N, M):
    H = (N-1) // 2
    LL = 0
    LR = (H // 2) * 2 + 1
    RL = N - (H - H//2) * 2
    RR = N
    pairs = []
    while LR - LL > 1:
        pairs.append((LL+1, LR))
        LL += 1
        LR -= 1
    while RR - RL > 1:
        pairs.append((RL+1, RR))
        RL += 1
        RR -= 1
    for i in range(M):
        print((*pairs[i]))


def __starting_point():
    inputs = read()
    solve(*inputs)

__starting_point()

import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    N, M = LI()
    used = [0 for _ in range(N)]
    cur = 0
    pairs = []
    used = set()
    if N % 2 == 0:
        a = 1
        b = N
        while len(pairs) < M:
            if b-a in used or N + a -b in used or b - a == N//2:
                b -= 1
            pairs.append((a, b))
            used.add(b-a)
            used.add(N+a - b)
            a += 1
            b -= 1

    else:
        a = 1
        b = N - 1
        while len(pairs) < M:
            pairs.append((a, b))
            a += 1
            b -= 1
    for p in pairs:
        print((p[0], p[1]))



main()



import sys

def solve():
    input = sys.stdin.readline
    N, M = map(int, input().split())
    used = set()
    Ans = [None for _ in range(M)]
    left = 1
    right = N
    for i in range(M):
        if right - left in used or 2 * (right - left) == N: right -= 1
        Ans[i] = (left, right)
        diff = right - left
        used |= {diff, N - diff}
        left += 1
        right -= 1
    for i in range(M): print(*Ans[i], sep=" ")

    return 0

def __starting_point():
    solve()
__starting_point()

n,m = map(int, input().split())
if n % 2 != 0:
    for i in range(1,m+1):
        print(i,n+1-i)
else:
    x = n//2
    for i in range((m+1)//2):
        print(i+1,x-i)
    for i in range(m//2):
        print(x+1+i, n-1-i)

n, m = list(map(int, input().split()))
a, b = n, 1
V = [False for d in range(1, n + 1)]
for i in range(m):
    d = min(a - b, n - (a - b))
    if 2 * d == n or V[d]:
        a -= 1
    print((a, b))
    d = min(a - b, n - (a - b))
    V[d] = True
    a -= 1
    b += 1


N, M = map(int, input().split())
for i in range(M, 0, -2):
    cur_start = (M - i) // 2
    print(cur_start + 1, cur_start + i + 1)
start = M + 2
for i in range(M -1, 0, -2):
    cur_start = start + (M -  1 - i) // 2
    print(cur_start, cur_start + i)

N, M = list(map(int, input().split()))
if N%2==0:
    r = N
    f = True
    for i in range(M):
        if f and i*4+2 >= N:
            r -= 1
            f = False
        print((1+i, r))
        r -= 1
else:
    for i in range(M):
        print((1+i, N-i))


n,m=[int(_) for _ in input().split()]

n=2*m+1
if m%2==0:
  for i in range(m//2):
    print(i+1,m-i)
  for i in range(m//2):
    print(m+1+i,n-i)
else:
  for i in range(m//2):
    print(i+1,m-i)
  for i in range(m//2+1):
    print(m+1+i,n-i)

def main():
    N, M = map(int, input().split())

    if N & 1:
        gen = ((i+1, N-i) for i in range(M))
    else:
        gen = ((i+1, N-i) if 2*i < N/2-1 else (i+1, N-i-1) for i in range(M))

    [print(*s) for s in gen]


def __starting_point():
    main()

__starting_point()

n, m = map(int, input().split())
if m % 2 == 1:

    cnt = 0

    for i in range(m // 2):
        num1 = 1 + i
        num2 = m - i
        print(num1, num2, sep=" ")
        cnt += 1
        if cnt == m:
            return
    for i in range(m // 2 + 1):
        num1 = m + 1 + i
        num2 = 2 * m + 1 - i
        print(num1, num2, sep=" ")
        cnt += 1
        if cnt == m:
            return
else:
    cnt = 0

    for i in range(m // 2):
        num1 = 1 + i
        num2 = m + 1 - i
        print(num1, num2, sep=" ")
        cnt += 1
        if cnt == m:
            return
    for i in range(m // 2):
        num1 = m + 2 + i
        num2 = 2 * m + 1 - i
        print(num1, num2, sep=" ")
        cnt += 1
        if cnt == m:
            return


n, m = list(map(int, input().split()))
if m == 1:
    print((1, 2))
    return
l1 = 1
l2 = m + 2
f = True
for length in range(m, 0, -1):
    if f:
        print((l1, l1 + length))
        l1 += 1
        f = False
    else:
        print((l2, l2 + length))
        l2 += 1
        f = True


def main():
    N, M = list(map(int, input().split()))  # N must be an odd number

    if N % 2 == 1:
        gen = ((i+1, N-i) for i in range(M))
    else:
        gen = ((i+1, N-i) if 2*i < N/2-1 else (i+1, N-i-1) for i in range(M))

    for s in gen:
        print((*s))


def __starting_point():
    main()

__starting_point()

N, M = map(int, input().split())
piv = N//4+(N%4==3)
pairs = [(str(piv-i), str(piv+1+i)) for i in range(N//4+(N%4==3))]
piv = N - N//4 + (N%4==0)
pairs += [(str(piv-1-i), str(piv+1+i)) for i in range(N//4-(N%4==0))]
for pair in pairs[:M]:
    print(' '.join(pair))

N, M = map(int, input().split())

if N%2:
    for i in range(M):
        print(2+i, N-i)
else:
    used = set()
    s = 1
    for i in list(range(2, M+1, 2)[::-1])+list(range(1, M+1, 2)[::-1]):
        while 1:
            if not s in used and not (s+i) in used:
                used.add(s)
                used.add(s+i)
                print(s, s+i)
                break
            s += 1



def main():
    N, M = list(map(int, input().split()))
    skip = (N // 2) // 2 + 1 if N % 2 == 0 else None
    count = 0
    left, right = 0, N + 1
    while count < M:
        left += 1
        if left == skip:
            continue
        right -= 1
        print((left, right))
        count += 1


def __starting_point():
    main()

__starting_point()

N, M = map(int, input().split())

#N人の参加者から、M組選ぶ
#これをNセット実施。
#組合わせの距離が重複しなければ、成立


#参加者を半分に分け、
#前半を距離奇数、後半を距離偶数にする

#参加者を半分に分ける
div_point=int((N/2))
#前半グループを奇数にする
if div_point%2==0:
    div_point-=1
#後半グループは更に半分に分ける
re_point=div_point+int((N-div_point)/2)

#組を作る
i=0 #初期化
while 1<div_point-i*2 and i<re_point and i<M:#前半グループ・・・距離が奇数になるように組み分け
    ent1=i+1 #前半グループ：一人目
    ent2=div_point-i #前半グループ：二人目
    print(str(ent1) + ' ' + str(ent2))
    i+=1
for j in range(M-i):#後半グループ
    ent1=re_point-j #後半グループ：一人目
    ent2=re_point+j+1 #後半グループ：二人目
    print(str(ent1) + ' ' + str(ent2))

N,M = map(int,input().split())
if N%2:
    for i in range(M):
        print(i+1, M*2-i)
else:
    b = M//2
    a = M - b
    for i in range(a):
        print(i+1, a*2-i)
    for i in range(b):
        print(a*2+1+i, M*2+1-i)

def main():
    N, M = list(map(int, input().split()))
    if N % 2 == 1:
        for i in range(M):
            print((i + 1, N - i - 1))
            
    else:
        s = set()
        t = 0
        for i in range(M):
            a, b = i + 1, N - i - t
            if (b - a) in s or (a + N - b) in s or b - a == a + N - b:
                t += 1
                b = N - i - t
            print((a, b))
            s.add(b - a)
            s.add(N + a - b)

main()


N,M= list(map(int, input().split()))

num = list(range(1,N+1))
ans = []


if M % 2 == 0:
    for i in range(M // 2):
        ans.append([i+1,M+1-i])
    for i in range(M // 2):
        ans.append([i+2+M,2*M+1-i])


if M % 2 != 0:
    for i in range(M // 2):
        ans.append([i+1,M-i])
    for i in range(M - M//2):
        ans.append([i+1+M,2*M+1-i])


for an in ans:
    print((an[0],an[1]))


from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq

n,m = list(map(int, input().split()))

p = m // 2
for i in range(p):
    print((p-i,p+2+i))

q = m // 2 + 1
if m % 2 == 1:
    for i in range(q):
        print((m+q-i,m+q+i+1))
else:
    for i in range(q-1):
        print((m+q-i,m+q+i+1))








n, m = list(map(int, input().split()))
ans = []
if n % 2 == 1:
    for i in range(m):
        ans.append((i+1, n-i))


else:
    for i in range(m):
        if i <= (m+1)//2-1:
            ans.append((i+1, n-i))
        else:
            ans.append((i+1, n-i-1))

for a, b in ans:
    print((a, b))


N,M=list(map(int, input().split()))
src=[i+1 for i in range(M*2+1)]
if M%2==0:
  for m in range(M//2):
    a=src[m]
    b=src[M-m]
    print('{} {}'.format(a,b))
  for m in range(M//2):
    a=src[M+1+m]
    b=src[-(m+1)]
    print('{} {}'.format(a,b))
else:
  for m in range(M//2):
    a=src[m]
    b=src[M-1-m]
    print('{} {}'.format(a,b))
  for m in range(M-(M//2)):
    a=src[M+m]
    b=src[-(m+1)]
    print('{} {}'.format(a,b))

n, m = map(int, input().split())
x, y = (m+1) // 2, m // 2
for i in range(x):
    print(1+i, 2*x-i)
for i in range(y):
    print(2*x+1+i, 2*x+1+2*y-i)

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

if n%2 != 0:
  for i in range(m):
    print(1+i,n-i)
else:
  for i in range(m):
    if (n-i)-(1+i) > n/2:
      print(1+i,n-i)
    else:
      print(1+i,n-i-1)


def __starting_point():
    nm = input()
    nm = nm.split()
    n = int(nm[0])
    m = int(nm[1])

    if n%2==1:
        for i in range(1,m+1):
            print((i,n+1-i))


    if n%2==0:
        t = n
        f = 0

        for i in range(1,m+1):
            p = i-1+t-n
            if p>=n-i-1 and f==0:
                f = 1
                n -= 1
            print((i,n))
            n -= 1

__starting_point()

n,m = list(map(int,input().split()))

a = n //2
b = a + 1
abset = set()

for i in range(m):
    print(a,b)
    abset.add(b-a)
    abset.add(n-b+a)
    a -= 1
    b += 1
    if n % 2 == 0 and (b - a == abs(n - b + a) or b - a in abset or n - b + a in abset):
        b += 1

import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

sys.setrecursionlimit(10 ** 7)

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

n, m = na()

if m == 1:
    print(1, 2)
    return

if m % 2 == 0:
    l = (m + 1) // 2
    r = (m + 1) // 2 + 2
    cnt = 0
    while cnt < m and l >= 1 and r <= (m + 1):
        print(l, r)
        l -= 1
        r += 1
        cnt += 1
    l = (n - m - 1) // 2
    r = (n - m - 1) // 2 + 1
    while cnt < m and l >= 1 and r <= (n - m - 1):
        print(m + 1 + l, m + 1 + r)
        l -= 1
        r += 1
        cnt += 1
else:
    l = m // 2
    r = m // 2 + 2
    cnt = 0
    while cnt < m and l >= 1 and r <= m:
        print(l, r)
        l -= 1
        r += 1
        cnt += 1
    l = (n - m) // 2
    r = (n - m) // 2 + 1
    while cnt < m and l >= 1 and r <= (n - m):
        print(m + l, m + r)
        l -= 1
        r += 1
        cnt += 1

n, m = list(map(int, input().split()))

def ark(a, b):
    return min(abs(a - b), n - abs(a - b))

a, b = n, 1
S = set()
for i in range(m):
    if 2 * ark(a, b) == n or ark(a, b) in S:
        a -= 1
    print((a, b))
    S.add(ark(a, b))
    a -= 1
    b += 1


N,M = [int(i) for i in input().split()]
if N%2 == 1:
    for i in range(1,M+1):
        print(i, end=" ")
        print(N+1-i)
    return
L = min(M,N//4)
for i in range(1,L+1):
    print(i,end=" ")
    print(N+1-i)
if L < M:
    for i in range(L+1,M+1):
        print(i,end=" ")
        print(N-i)

def main():
    N, M = list(map(int, input().split()))
    ans = list()
    if N % 2 == 1:
        for k in range(min(N // 2, M)):
            ans.append((k + 1, N - k))
    else:
        K = N // 2 - 1
        for k in range((K + 1) // 2):
            if len(ans) >= M:
                break
            ans.append((k + 1, N - k))
        for k in range(K // 2):
            if len(ans) >= M:
                break
            b = N - (K + 1) // 2 - k
            a = b - 2 * (K // 2 - k)
            ans.append((a, b))
    for row in ans:
        print(('{} {}'.format(row[0], row[1])))


def __starting_point():
    main()

__starting_point()


def resolve():
    N, M = map(int, input().split())

    if M == 1:
        print(1, 2)
        return

    i1 = 1
    i2 = M+2
    for diff in range(M, 0, -1):
        print(i1, i1+diff)
        i1 += 1
        i1, i2 = i2, i1

def __starting_point():
    resolve()
__starting_point()

n, m = list(map(int, input().split()))

if n % 2 == 1:
    for i in range(m):
        print((n - i, i + 1))
else:
    used = [False] * (n + 1)
    offset = 0
    for i in range(m):
        a = n - (i + offset)
        b = i + offset + 1
        d = min(a - b, n - (a - b))
        if used[d] or a - b == n - (a - b):
            offset = 1
        used[d] = True
        print((n - i, i + offset + 1))


N, M = list(map(int, input().split()))
odd_l = 1
odd_r = M
even_l = M + 1
even_r = 2 * M + 1
i = 0
while i < M:
    print((even_l, even_r))
    i += 1
    if i == M:
        break
    print((odd_l, odd_r))
    i += 1
    odd_l += 1
    odd_r -= 1
    even_l += 1
    even_r -= 1


# 入力
N, M = map(int, input().split())

# 番号を入力
A = [int(i) for i in range(N)]

B = [] # 台No. リスト

if N % 2 == 0:
    # N が偶数の場合

    center = N // 2
    c1 = center // 2
    c2 = center + c1
    # print(c1,c2)

    for i in range(1, M+1):
        # print(i)
        j = i // 2
        # print("j", j)
        if i % 2 == 1:
            B.append((c1-j, c1+j+1))
        else:
            B.append((c2-(j-1), c2 - (j-1) + 2*j ))

else:
    # N が奇数の場合

    center = N // 2 + 1
    # print(center)
    for i in range(1, M+1):
        B.append((center - i, center + i))
        
for i in B:
    print(i[0], i[1])

n, m = map(int, input().split())
if n % 2 == 1:
    for i in range(m):
        print(i + 1, n - i)
else:
    for i in range(m):
        if 2 * (i + 1) <= m + 1:
            print(i + 1, n - i)
        else:
            print(i + 1, n - i - 1)

#coding:utf-8

n,m = map(int,input().split())
point_s = 0
point_e = n + 1

if n % 2 == 0:
    for i in range(1,m+1):
        point_s += 1
        point_e -= 1
        print("{} {}".format(point_s,point_e))
        if n % 4 == 0 and (point_e - point_s - 1) * 2 == n:
            point_e -= 1
        elif n % 4 != 0 and (point_e - point_s - 1) * 2 == n + 2:
            point_e -= 1
elif n % 2 == 1:
    for i in range(1,m+1):
        point_s += 1
        point_e -= 1
        print("{} {}".format(point_s,point_e))

n, m = map(int, input().split())
for i in range(m):
    if n % 2 == 0 and n // 2 <= (m - i) * 2 - 1:
        x = 1
    else:
        x = 0
    print(i + 1, (m - i) * 2 + i + x)

n,m = list(map(int,input().split()))

k = 1
k_even = n//2+1
p_even = k_even+1

def rotate(s,diff):
    if s + diff < 1:
        return s+diff+n
    elif s + diff > n:
        return s+diff-n
    return s+diff

for i in range(m+1):
    if i != 0 and i % 2 == 0:
        print((rotate(k,-(i//2)),rotate(k,i//2)))

    if i % 2 == 1:
        print((rotate(k_even,-(i//2)),rotate(p_even,i//2)))




n,m=list(map(int,input().split()))
if n%2==1:
  for i in range(m):
    print((n-i-1,i+1))
else:
  cnt=1
  for i in range(m):
    if i%2==0:
      print((n//4-i//2,n//4-i//2+cnt))
    else:
      print((n//2+n//4-i//2,n//2+n//4-i//2+cnt))
    cnt+=1


import os
from collections import Counter

import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353


N, M = list(map(int, sys.stdin.buffer.readline().split()))


def test(ans):
    hist = []
    for a, b in ans:
        hist.append((0, (b - a) % N))
        hist.append((0, (a - b) % N))
    print((len(set(hist)) == M * 2))
    print((Counter(hist)))


ans = []
if N % 2 == 1:
    for i in range(M):
        a, b = i + 1, N - i
        ans.append((a, b))
else:
    hist = set()
    d = 0
    for i in range(M):
        a, b = i + 1, N - i - d
        if (a - b) % N in hist or (b - a) % N in hist or (a - b) % N == (b - a) % N:
            d += 1
            a, b = i + 1, N - i - d
        hist.add((a - b) % N)
        hist.add((b - a) % N)
        ans.append((a, b))

for a, b in ans:
    print((a, b))

# test(ans)


def resolve():
    N,M = map(int,input().split())
    if N % 2 == 1:
        for i in range(M):
            print(str(i+1) + " " + str(N-i))
    else:
        for i in range((M-1) // 2 + 1):
            print(str(i+1) + " " + str(N-i))
        for i in range((M-1) // 2 + 1 , M):
            print(str(i+1) + " " + str(N-i-1))
resolve()

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

if m % 2 ==0:
    for i in range(m//2):
        print(1+i, m-i)
        print(m+1+i, 2*m+1-i)
else:
    for i in range((m//2)+1):
        print(m+1+i, 2*m+1-i)
    for i in range(m//2):
        print(1+i, m-i)

import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n, m = list(map(int, input().split()))

    if n % 2:
        left = 1
        right = n - 1
        while left < right and m:
            print((left, right))
            left += 1
            right -= 1
            m -= 1
    else:
        left = 1
        right = n - 1
        flg = False
        while left < right and m:
            if not flg and right - left <= n // 2:
                right -= 1
                flg = True
            print((left, right))
            left += 1
            right -= 1
            m -= 1


def __starting_point():
    resolve()

__starting_point()

n,m=list(map(int,input().split()))

if n%2 == 1:
  for i in range(1,m+1):
    a,b=i,n-i
    print((a,b))
else:
  for i in range(1,m+1):
    a,b = i,n-i
    if b-a <= n//2:
      a+=1
    print((a,b))


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

a = 1
b = m - 1
c = m
d = [i for i in range(n + 1)]

for i in range(m):
    if m % 2 == 0 and i < m / 2:
        print(d[a], d[a+b])
        print(d[-a-c],d[-a])
        a = a + 1
        b = b - 2
        c = c - 2

    elif m % 2 != 0 and i < m / 2:
        print(d[-a-c],d[-a])
        if i == (m + 1) / 2 - 1:
            break
        print(d[a], d[a+b])
        a = a + 1
        b = b - 2
        c = c - 2  

N, M = list(map(int, input().split()))

for i in range(1, M + 1):
    if i % 2 == 1:
        j = (i - 1) // 2
        print((1 + j, M + 1 - j))
    else:
        j = (i - 2) // 2
        print((M + 2 + j, 2 * M + 1 - j))


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

N,M = list(map(int, input().rstrip().split()))
#-----
ans = []
delta = 0
visited = set()


for i in range(M):
    L = 1+i
    R = N-i
    diff = (R - delta) - L
    
    if (2*diff == N) or \
       (diff in visited) or ((N - diff) in visited):
       
        delta = 1
    
    ans.append( [L, R - delta] )
    visited |= {diff , (N - diff)}


for nums in ans:
    print((*nums))


# 構成系の問題だ。題意が読み取りづらいけど。
# 円周上にn個の点を並べ、k本の線分を結ぶ。
# 線分は端点を共有しないし、長さ（飛ばした点の個数）がすべて異なる。ようにせよ。という問題
# nが奇数の場合は端から順に結べばすべて異なる。偶数の場合、それだと同じ長さが出るので、半周回ったところで1つずらす。

# 6 2で不正解。円の直径を引いてはいけないんだな。

n, k = list(map(int, input().split()))

if n % 2 == 1:
    p = 1
    q = n
    for i in range(k):
        print(f'{p} {q}')
        p += 1
        q -= 1

else:
    p = 1
    q = n
    for i in range(k):
        print(f'{p} {q}')
        if abs(p-q) == n//2+1 :
            p += 1
        p += 1
        q -= 1
        if abs(p-q) == n//2 :
            p += 1




n,m=map(int,input().split())
if n%2==1:
  ab=[]
  a=n//2
  b=n//2+1
  ab.append([str(a),str(b)])
  for _ in range(m-1):
    a-=1
    b+=1
    ab.append([str(a),str(b)])
  for a,b in ab:
    print(a,b)
else:
  l=m
  ab=[]
  cnt=0
  for i in range(m):
    if i%2==0:
      a=i//2+1
      b=a+l
    else:
      a=n-(i//2+1)
      b=a-l
    ab.append([str(a),str(b)])
    l-=1
  for a,b in ab:
    print(a,b)

n, m = list(map(int, input().split()))

even = m // 2
odd = m - even

odd_left = 1
odd_right = 2 * odd

even_left = odd_right + 1
even_right = even_left + 2 * even

for _ in range(odd):
    print((odd_left, odd_right))
    odd_left += 1
    odd_right -= 1

for _ in range(even):
    print((even_left, even_right))
    even_left += 1
    even_right -= 1


N, M = list(map(int, input().split()))

n = 2*M+1
# Mが奇数の場合
if M%2==1:
    for i in range(1, M//2+1):
        print(('{} {}'.format(i,M+1-i)))
    for i in range(1, (M+1)//2+1):
        print(('{} {}'.format(M+i,2*M+2-i)))
# Mが偶数の場合
else:
    for i in range(1, M//2+1):
        print(('{} {}'.format(i,M+2-i)))
    for i in range(1, M//2+1):
        print(('{} {}'.format(M+i+1,2*M+2-i)))
    


#import numpy as np
#import math
#from decimal import *
#from numba import njit

#@njit
def main():
    N,M = list(map(int, input().split()))
    i = 1
    for m in range(M):
        if N%2 == 0 and i%2 == 1 and i >= N/2:
            i += 1
        print((M-m,M-m+i))
        i += 2
    

main()


N, M = map(int, input().split())

if N % 2 == 1:
    for a in range(1, M + 1):
        print(a, N - a + 1)
else:
    for a in range(1, M + 1):
        if a < -(-M // 2) + 1:
            print(a, N - a + 1)
        else:
            print(a, N - a)

N,M=list(map(int,input().split()))
if N%2==0:
    for i in range(1,(M+1)//2+1):
        print((i,N-i+1))
    for i in range(M-(M+1)//2):
        print((M-i,M+i+2))
else:
    for i in range(1,M+1):
        print((i,N-i))


n,m = list(map(int,input().split()))
if(n % 2 == 0):
    d = n // 2 - 1
    c = 0
    i = 1
    while(d > 0):
        print((i,i+d))
        d -= 2
        i += 1
        c += 1
        if(c == m):return
    d = n // 2 - 2
    i = n // 2 + 1
    while(d > 0):
        print((i,i+d))
        d -= 2
        i += 1
        c += 1
        if(c == m):return


else:
    for i in range(m):
        print((i+1,n-i))


#from collections import deque,defaultdict
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

n,m = inm()
if n%2==1:
    for i in range(1,m+1):
        print('{} {}'.format(i,n-i))
elif n%4==0:
    e = min(m+1,n//4)
    for i in range(1,e):
        print('{} {}'.format(i,n//2-i))
    if m>=n//4:
        for i in range(m-n//4+1):
            print('{} {}'.format(n-1-i,n//2+i))
else:
    e = min(m+1,n//4+1)
    for i in range(1,e):
        print('{} {}'.format(i,n//2-i+1))
    if m>=n//4+1:
        for i in range(m-n//4):
            print('{} {}'.format(n-1-i,n//2+i+1))


N, M = map(int, input().split())

if N % 2 == 1:
    for i in range(1, M + 1):
        l = i
        r = N - i
        print(l, r)
else:
    flag = False
    l = 1
    r = N - 1
    cnt = 0
    while cnt < M:
        if not flag and r - l <= N // 2:
            r -= 1
            flag = True
        print(l, r)
        l += 1
        r -= 1
        cnt += 1

import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
mod2 = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    n,m = LI()

    rr = []
    if n % 2 == 1:
        t = n // 2 + 1
        for i in range(1, m+1):
            rr.append((t-i,t+i))
    else:
        t1 = (m+1) // 2
        t2 = n - m // 2
        for i in range(t1):
            rr.append((t1-i,t1+1+i))
        for i in range(1, m // 2 + 1):
            rr.append((t2-i, t2+i))

    return JAA(rr, "\n", " ")

print(main())





'''
N人を円周上に配置し、M本の線分で結ぶ。
このとき、線分を回転させていっても同じ人のペアが生まれないようにする。

基本的には、上から順に結べばよい。
'''

from collections import deque

def main():
    N, M = list(map(int, input().split()))
    if N&1:
        '''
        ・Nが奇数の場合
        
        上から順に結ぶだけ。
        dequeに 1,2,3,...,M*2 を突っ込んで、両端から取り出してペアにする。
        '''
        q = deque(list(range(M*2)))
        while q:
            print((q.popleft()+1, q.pop()+1))
    else:
        '''
        [Nが偶数の場合]
        
        上から順に結ぶと、上下の線対称になり、同じ間隔のペアが生まれるためNG。
        → 半分以降は、1つずらしてペアを作っていく

        簡単に解決するため、
        ・上から順に奇数間隔ペアを作る
        ・下から順に偶数間隔ペアを作る
        この2つから、M個を順に、交互に取り出す。
        '''
        q1 = deque(list(range(N)))
        q2 = deque(list(range(N-1)))
        p1 = []
        while q1:
            p1.append((q1.popleft()+1, q1.pop()+1))
        p2 = []
        while len(q2)>=2:
            p2.append((q2.popleft()+1, q2.pop()+1))
        p2.reverse()
        for _ in range(M):
            print((*p1.pop()))
            p1, p2 = p2, p1


main()



N,M = map(int, input().split())

a = 1
b = N
for i in range(M, 0, -1):
    if i%2 == M%2:
        print(a, a+i)
        a += 1
    else:
        print(b, b-i)
        b -= 1

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

if n%2:
  for i in range(1, m+1):
    print(i, n-i)
else:
  for i in range(1, m+1):
    if 2*i >= n/2:
      print(i, n-i-1)
    else:
      print(i, n-i)

import sys
from collections import deque, defaultdict, Counter
from itertools import accumulate, product, permutations, combinations
from operator import itemgetter
from bisect import bisect_left, bisect_right
from heapq import heappop, heappush
from math import ceil, floor, sqrt, gcd, inf
from copy import deepcopy
import numpy as np
import scipy as sp

INF = inf
MOD = 1000000007

n, m = [int(i) for i in input().split()]

tmp_l = m + 1
tmp_r = m - 1
res = []

while tmp_r > 0:
    res.append([tmp_l + 1, tmp_l + tmp_r + 1])
    tmp_l += 1
    tmp_r -= 2
tmp_l = 0
tmp_r = m
while tmp_r > 0:
    res.append([tmp_l + 1, tmp_l + tmp_r + 1])
    tmp_l += 1
    tmp_r -= 2
res = "\n".join([" ".join([str(i) for i in j]) for j in res])

print(res)


from collections import deque

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

x = deque(range(1, n + 1))
aaa = []
bbb = []
flag = True

if n % 2 == 1:
    for i in range(m):
        a = x.popleft()
        aaa.append(a)
        b = x.pop()
        bbb.append(b)

else:
    for i in range(m):
        # ｎが偶数の場合は途中で1個捨てる
        a = x.popleft()
        aaa.append(a)
        b = x.pop()
        bbb.append(b)
        if x[-1] - x[0] <= n // 2 and flag:
            a = x.popleft()
            flag = False

for aa, bb in zip(aaa, bbb):
    print(aa, bb)

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


def __starting_point():
    main()
__starting_point()

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

def dist(a, b):
    return min(abs(a - b), n - abs(a - b))

a, b = n, 1
S = set()
for i in range(m):
    if 2 * dist(a, b) == n or dist(a, b) in S:
        a -= 1
    print(a, b)
    S.add(dist(a, b))
    a -= 1
    b += 1

import sys
readline = sys.stdin.readline

n,m = map(int,readline().split())

l=1
r=n
used = set()
while len(used) < m * 2:
  diff = r - l
  rdiff = n - diff
  if diff == rdiff:
    r -= 1
    continue
  if diff in used:
    r -= 1
    continue
  print(l,r)
  used.add(diff)
  used.add(rdiff)
  l += 1
  r -= 1

n,m=map(int,input().split())
lange=[1]*(n+1)
for i in range(1,n+1):
  a=i
  b=n-a
  if lange[a]:lange[b]=0
langes=[]
for i in range(1,n):
  if lange[i]:
    if len(langes)%2:langes.append(i)
    else:langes.append(n-i)
langes.sort(reverse=1)
for i in range(m):print(i+1,i+1+langes[i])

N,M=map(int,input().split())
a=M//2
b=M-a
c=1
d=2*a+1
for i in range(a):
  print(c,d)
  c+=1
  d-=1
e=2*a+2
f=2*M+1
for i in range(b):
  print(e,f)
  e+=1
  f-=1

def getN():
    return int(input())
def getNM():
    return list(map(int, input().split()))
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from decimal import *
from heapq import heapify, heappop, heappush
import math
import random
import string
from copy import deepcopy
from itertools import combinations, permutations, product
from operator import mul, itemgetter
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

#############
# Main Code #
#############

# 割り当てを一つ求める
# N回Mラウンドを行う 1ラウンドあたりの最大対戦者数はN以下になる

# 対戦者A, B, C, D...にそれぞれ１、２、３、４...を割り当てる
# 試合後、A, B, C, D...の数字は２、３、４、５...になる N + 1になったら１になる
# N, M = 4, 1の時 M1に[1, 2]を割り当てると
#   A B C D
# 1 1 2 3 4 A vs B
# 2 2 3 4 1 D vs A
# 3 3 4 1 2 C vs D
# 4 4 1 2 3 B vs C なのでok
# Nラウンドでちょうど一周するので、M = 1の時は何を入れてもok

# N, M = 5, 2の時
#   A B C D E
# 1 1 2 3 4 5
# 2 2 3 4 5 1
# 3 3 4 5 1 2
# 4 4 5 1 2 3
# 5 5 1 2 3 4

# M1には何を指定してもいい？
# 少なくともM1とM2が同じパターン(i, i+1等)はダメ
# 全てのMについて違うパターンで数字を割り当てられるか
# = 任意のMi(ai, bi), Mj(aj, bj)について abs(bi - ai) != abs(bj - aj)
N, M = getNM()
A = []
B = []
if N % 2 != 0:
    for i in range(M):
        A.append(i + 1)
        B.append(N - i)
else:
    for i in range(M):
        A.append(i + 1)
        if i <= ((N // 4) - 1):
            B.append(N - i)
        else:
            B.append(N - i - 1) # 一つずらす
for i in range(M):
    print((A[i], B[i]))


# コーナーケースあり
# 前と後ろから取っていったのではダメなケース？
# ちょうどrotateしたところ
# N, M = 6, 2
# m1に[1, 6], m2に[3, 4]を指定するとダブル
#   A B C D E F
# 1 1 2 3 4 5 6
# 2 2 3 4 5 [6 1] E, F
# 3 3 4 5 6 1 2
# 4 4 5 6 1 2 3
# 5 5 6 1 2 [3 4] E, F
# 6 6 1 2 3 4 5

# rotateしてもダブらないように
# m1に[1, 6], m2に[2, 3]を指定すると
#   A B C D E F
# 1 1 2 3 4 5 6
# 2 2 3 4 5 [6 1] E vs F
# 3 3 4 5 6 1 2
# 4 4 5 6 1 2 3
# 5 5 6 1 2 3 4
# 6 6 1 2 3 4 5

# 偶奇で分かれる？
# 奇数の場合は大丈夫
# m1 間はN - 2(奇数), 0
# m2 間はN - 4(奇数), 2

# 偶数の場合はダメ
# うまくズラして
# m1 間はN - 2(偶数), 0
# m2 間はN - 4(偶数), 2

# m1 間はN - 2, 0
# m2 間はN - 4, 2
# m3 間はN - 6, 4
# ...
# mm-2 間は6, N - 6
# mm-1 間は4, N - 4
# mm 間は2, N - 2
# 関係があるのは1個目とN個目, 2個目とN-1個目...
# 小さい方から半分については１個ずらす


N, M = map(int, input().split())

if N % 2 == 1:
    for a in range(1, M + 1):
        print(a, N - a + 1)
else:
    for a in range(1, M + 1):
        print(a, N - a + (a <= N // 4))

N,M = list(map(int, input().split()))

if N%2 == 1:
  for i in range(1,M+1):
    print(i, N-i)
else:
  # N=8 M=3 (8,1), (4,6), (7,2)
  # N=10, M=4 (10,1), (5,7), (9,2), (4,8)
  for i in range(M):
    if i%2 == 0:
      x = i//2
      print(N-x, 1+x)
    else:
      cent = N//2+1
      x = i//2+1
      print(cent-x, cent+x)

def main():
    n, m = list(map(int, input().split()))
    ans = []
    t = [True]*(n+1)
    l = n//2 - 1
    for i in range(1, n//2):
        if l <= 0:
            break
        if not t[i] or not t[i+l]:
            continue
        ans.append([i, i+l])
        t[i] = False
        t[i+l] = False
        l -= 2
    if n % 2 == 1:
        l = n//2
        for i in range(n//2, n):
            if l <= 0:
                break
            if not t[i] or not t[i+l]:
                continue
            ans.append([i, i+l])
            t[i] = False
            t[i+l] = False
            l -= 2
    else:
        l = n//2 - 2
        for i in range(n//2, n):
            if l <= 0:
                break
            if not t[i] or not t[i+l]:
                continue
            ans.append([i, i+l])
            t[i] = False
            t[i+l] = False
            l -= 2
    for i in range(m):
        print((ans[i][0], ans[i][1]))

def __starting_point():
    main()

__starting_point()

#!/usr/bin/env python3
n, m = list(map(int, input().split()))
d = m
r = d + 1
for i in range(m):
    if d <= 0:
        break
    a = i + 1
    b = a + d
    print((a, b))
    d -= 2
d = m - 1
for i in range(m):
    if d <= 0:
        break
    a = r + i + 1
    b = a + d
    print((a, b))
    d -= 2


from collections import deque

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

x = deque(range(1, n + 1))
aaa = []
bbb = []
flag = True

if n % 2 == 1:
    for i in range(m):
        a = x.popleft()
        aaa.append(a)
        b = x.pop()
        bbb.append(b)

else:
    for i in range(m):
        # ｎが偶数の場合は途中で1個捨てる
        a = x.popleft()
        aaa.append(a)
        b = x.pop()
        bbb.append(b)
        if x[-1] - x[0] <= n // 2 and flag:
            a = x.popleft()
            flag = False

for aa, bb in zip(aaa, bbb):
    print(aa, bb)

#!/usr/bin/env python3
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2


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


def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


def solve(N, M):
    ans = []
    now = 0
    for d in range(M, 0, -2):
        ans.append((now, now + d))
        now += 1

    now = M + 1
    for d in range(M - 1, 0, -2):
        ans.append((now, (now + d) % N))
        now += 1

    return ans


def main():
    N, M = list(map(int, input().split()))
    ans = solve(N, M)
    for x in ans:
        print(f"{x[0] + 1} {x[1] + 1}")


def __starting_point():
    main()

__starting_point()

n, m = list(map(int, input().split()))
if m == 1:
    print((1, 2))
    return
l1 = 1
l2 = m + 2
f = True
for length in range(m, 0, -1):
    if f:
        print((l1, l1 + length))
        l1 += 1
        f = not f
    else:
        print((l2, l2 + length))
        l2 += 1
        f = not f


N, M = map(int, input().split())
if N%2:
    for i in range(M):
        print(i+1, N-i)
elif N%4:
    for i in range(M):
        if i < N//4:
            print(i+1, N-i-1)
        else:
            print(i+1, N-i-2)
else:
    for i in range(M):
        if i < N//4-1:
            print(i+1, N-i-1)
        else:
            print(i+1, N-i-2)

N,M=map(int,input().split())
sets=[]
if N%2==1:
    for i in range(M):
        sets.append((i+1,i+1+(N-3-2*i)+1))
elif N%2==0:
    count=0
    kukan=[]
    for i in range(N//2-1):
        kukan.append(count)
        count+=2
        if count==N//2 or count==N//2-1:
            count+=1
    kukan.reverse()
    for i in range(M):
        sets.append((i+1,i+1+kukan[i]+1))
for set1 in sets:
    print(set1[0],set1[1])

def main():
    import sys
    input = sys.stdin.readline

    n, m = map(int, input().split())
    l = 1
    r = n
    if n % 2 == 1:
        for i in range(m):
            print(f"{l} {r}")
            l += 1
            r -= 1
    else:
        flag = True
        for i in range(m):
            if flag and r - l <= n // 2:
                r -= 1
                flag = False
            print(f"{l} {r}")
            l += 1
            r -= 1


main()

n,m=list(map(int,input().split()))

oddflag=True
for i in range(1,m+1):
	mid=(1+n)//2
	if oddflag:
		oddflag = False
		print((i//2 + 1 , n - i//2))
	else:
		oddflag = True
		print((mid + i//2, mid - i//2))


# 解説を参考に作成


def solve():
    N, M = list(map(int, input().split()))

    m = 0
    # 奇数の飛び
    oddN = M
    oddN += (oddN + 1) % 2
    for i in range(oddN // 2):
        print((i + 1, oddN - i))
        m += 1
        if m == M:
            return
    # 偶数の飛び
    for i in range(M):
        print((oddN + i + 1, M * 2 + 1 - i))
        m += 1
        if m == M:
            return


def __starting_point():
    solve()

__starting_point()

N,M=map(int, input().split())
D=[]
E=[]
if M%2==0:
  if N%2==0:
    N-=1
  a=(N+1)//2
  for i in range(a//2):
    D.append((i+1,a-i))
  for d,e in D:
    E.append((d+a,e+a-1))
else:
  if N%2==0:
    N-=1
  a=N//2
  for i in range(a//2):
    D.append((i+1,a-i))
  for d,e in D:
    E.append((d+a+1,e+a))
  E.append((a+1,N))
F=D+E
for i in range(M):
  print(*F[i])