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



A = list(range(M))

B = list(range(M, 2*M))[::-1]

B = [-2-i for i in range(M//2)] + B[M//2:]



for a, b in zip(A, B):

    print((a % N + 1, b % N + 1))

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

if M & 1:

    print((M, M+1))

m=M//2

for i in range(m):

    print((i+1, (-2-i)%N+1))

    print((i+m+1, 2*M-m-i))

N, M = list(map(int, input().split()))
A = list(range(M))
B = list(range(M, 2 * M))[::-1]
B = [-2 - i for i in range(M // 2)] + B[M // 2 :]
for a, b in zip(A, B):
    print((a % N + 1, b % N + 1))

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

-A = list(range(M)) -B = list(range(M, 2 * M))[::-1] -B = [-2 - i for i in range(M // 2)] + B[M // 2 :] -for a, b in zip(A, B): -    print((a % N + 1, b % N + 1)) +if M & 1: +    print((M, M + 1)) +m = M // 2 +for i in range(m): +    print((i + 1, (-2 - i) % N + 1)) +    print((i + m + 1, 2 * M - m - i))