This morning Tolik has understood that while he was sleeping he had invented an incredible problem which will be a perfect fit for Codeforces! But, as a "Discuss tasks" project hasn't been born yet (in English, well), he decides to test a problem and asks his uncle.

After a long time thinking, Tolik's uncle hasn't any ideas on how to solve it. But, he doesn't want to tell Tolik about his inability to solve it, so he hasn't found anything better than asking you how to solve this task.

In this task you are given a cell field $n \cdot m$, consisting of $n$ rows and $m$ columns, where point's coordinates $(x, y)$ mean it is situated in the $x$-th row and $y$-th column, considering numeration from one ($1 \leq x \leq n, 1 \leq y \leq m$). Initially, you stand in the cell $(1, 1)$. Every move you can jump from cell $(x, y)$, which you stand in, by any non-zero vector $(dx, dy)$, thus you will stand in the $(x+dx, y+dy)$ cell. Obviously, you can't leave the field, but also there is one more important condition — you're not allowed to use one vector twice. Your task is to visit each cell of the field exactly once (the initial cell is considered as already visited).

Tolik's uncle is a very respectful person. Help him to solve this task!


-----Input-----

The first and only line contains two positive integers $n, m$ ($1 \leq n \cdot m \leq 10^{6}$) — the number of rows and columns of the field respectively.


-----Output-----

Print "-1" (without quotes) if it is impossible to visit every cell exactly once.

Else print $n \cdot m$ pairs of integers, $i$-th from them should contain two integers $x_i, y_i$ ($1 \leq x_i \leq n, 1 \leq y_i \leq m$) — cells of the field in order of visiting, so that all of them are distinct and vectors of jumps between them are distinct too.

Notice that the first cell should have $(1, 1)$ coordinates, according to the statement.


-----Examples-----
Input
2 3

Output
1 1
1 3
1 2
2 2
2 3
2 1
Input
1 1

Output
1 1



-----Note-----

The vectors from the first example in the order of making jumps are $(0, 2), (0, -1), (1, 0), (0, 1), (0, -2)$.

Difficulty: competition

Starter code:

Solutions:
import sys
input = sys.stdin.readline

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

for i in range(1,n//2+1):
    for j in range(1,m+1):
        sys.stdout.write("".join((str(i)," ",str(j),"\n")))
        sys.stdout.write("".join((str(n-i+1)," ",str(m-j+1),"\n")))



if n%2==1:
    for j in range(1,m//2+1):
        sys.stdout.write("".join((str(n//2+1)," ",str(j),"\n")))
        sys.stdout.write("".join((str(n//2+1)," ",str(m-j+1),"\n")))

    if m%2==1:
        sys.stdout.write("".join((str(n//2+1)," ",str(m//2+1),"\n")))



import sys
input = sys.stdin.readline

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

for i in range(1,n//2+1):
    for j in range(1,m+1):
        sys.stdout.write((str(i)+" "+str(j)+"\n"))
        sys.stdout.write((str(n-i+1)+" "+str(m-j+1)+"\n"))


if n%2==1:
    for j in range(1,m//2+1):
        sys.stdout.write((str(n//2+1)+" "+str(j)+"\n"))
        sys.stdout.write((str(n//2+1)+" "+str(m-j+1)+"\n"))

    if m%2==1:
        sys.stdout.write((str(n//2+1)+" "+str(m//2+1)+"\n"))



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

    r = []
    rappend = r.append
    for i in range(1, (n >> 1) + 1):
        for j in range(1, m + 1):
            rappend(str(i) + ' ' + str(j))
            rappend(str(n + 1 - i) + ' ' + str(m + 1 - j))

    if n & 1:
        for i in range(1, (m >> 1) + 1):
            rappend(str((n + 1) >> 1) + ' ' + str(i))
            rappend(str((n + 1) >> 1) + ' ' + str(m + 1 - i))
        if m & 1:
            rappend(str((n + 1) >> 1) + ' ' + str((m + 1) >> 1))

    print('\n'.join(r))


main()


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

    r = []
    rappend = r.append
    for i in range(1, (n >> 1) + 1):
        for j in range(1, m + 1):
            rappend(str(i) + ' ' + str(j))
            rappend(str(n + 1 - i) + ' ' + str(m + 1 - j))

    if n & 1:
        for i in range(1, (m >> 1) + 1):
            rappend(str((n + 1) >> 1) + ' ' + str(i))
            rappend(str((n + 1) >> 1) + ' ' + str(m + 1 - i))
        if m & 1:
            rappend(str((n + 1) >> 1) + ' ' + str((m + 1) >> 1))

    print('\n'.join(r))


main()


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

Ans = [(0, 0) for  _ in range(N*M)]
for i in range(1, N*M+1):
    if i % 2:
        a, b = divmod(i//2, M)
    else:
        a, b = divmod(N*M - i//2, M)
    Ans[i-1] = ' '.join((str(a+1), str(b+1)))

for a in Ans:
    sys.stdout.write(f'{a}\n') 


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

Ans = [(0, 0) for  _ in range(N*M)]
for i in range(1, N*M+1):
    if i % 2:
        a, b = divmod(i//2, M)
    else:
        a, b = divmod(N*M - i//2, M)
    Ans[i-1] = (a+1, b+1)
for a in Ans:
    sys.stdout.write('{} {}\n'.format(*a))

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

Ans = [None]*(N*M)
for i in range(1, N*M+1):
    if i % 2:
        a, b = divmod(i//2, M)
    else:
        a, b = divmod(N*M - i//2, M)
    Ans[i-1] = (a+1, b+1)
for a in Ans:
    sys.stdout.write('{} {}\n'.format(*a))

import math

inp = input().split(' ')
m = int(inp[0])
n = int(inp[1])

result = []

for column in range(1, math.ceil(m/2) + 1):

    rowRange = list(range(1, n + 1))
    if column == math.ceil(m / 2) and m % 2 == 1:
        rowRange = list(range(1, math.ceil(n/2) + 1))

    for row in rowRange:
        result.append(str(column) + ' ' + str(row))
        if row == math.ceil(n/2) and n % 2 == 1 and column == math.ceil(m / 2) and m % 2 == 1:
            continue
        result.append(str(m + 1 - column) + ' ' + str(n + 1 - row))

print('\n'.join(result))



n, m = map(int, input().split())
buf = []
for i in range(n//2):
    for j in range(m):
        buf.append(f'{i + 1} {j + 1}\n')
        buf.append(f'{n - i} {m - j}\n')

if n % 2 == 1:
    for j in range(m // 2):
        buf.append(f'{n // 2 + 1} {j + 1}\n')
        buf.append(f'{n // 2 + 1} {m - j}\n')
    if m % 2 == 1:
        buf.append(f'{n//2 + 1} {m//2 + 1}\n')
print(*buf, sep='')

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

np1 = n + 1
mp1 = m + 1

for i in range(1, 1 + n // 2):
  for j in range(1, mp1):
    # print(i, j)
    # print(np1 - i, mp1 - j)
    print('%d %d\n%d %d' % (i,j,np1-i,mp1-j))

if n & 1:
  i = 1 + n // 2
  for j in range(1, 1 + m // 2):
    # print(i, j)
    # print(i, mp1 - j)
    print('%d %d\n%d %d' % (i,j,i,mp1-j))

  if m & 1:
    print(i, 1 + m // 2)


import sys
import math
from collections import defaultdict
n,m=list(map(int,sys.stdin.readline().split()))
#cur=[1,1]
#ans=[-1 for _ in range(2*n*m)]
up,down=1,n
count=0
while up<=down:
    left,right=1,m
    #ans.append(cur)
    while left<=m and count<n*m:
        #ans.append([up,left])
        #ans[count]=[up,left]
        if count<n*m:
            sys.stdout.write((str(up)+" "+str(left)+"\n"))
        count+=1
        left+=1
        #ans[count]=[down,right]
        if count<n*m:
            sys.stdout.write((str(down)+" "+str(right)+"\n"))
        count+=1
            #ans.append([down,right])
        right-=1
    up+=1
    down-=1
'''if n==1:
    a=len(ans)
    #print(a,'a')
    for i in range(a//2):
        print(ans[i][0],ans[i][1])
else:
    a=len(ans)
    for i in range(a//2):
        print(ans[i][0],ans[i][1])
    #print(ans)'''
        


import sys
input=sys.stdin.readline
n,m=map(int,input().split())
for i in range(n//2+n%2):
    x1=i+1
    x2=n-i
    if(x1==x2):
        for j in range(m//2+m%2):
            if(j+1==m-j):
                sys.stdout.write((str(x1)+" "+str(j+1)+"\n"))
            else:
                sys.stdout.write((str(x1)+" "+str(j+1)+"\n"))
                sys.stdout.write((str(x2)+" "+str(m-j)+"\n"))
    else:
        if(i%2==0):
            for j in range(m):
                sys.stdout.write((str(x1)+" "+str(j+1)+"\n"))
                sys.stdout.write((str(x2)+" "+str(m-j)+"\n"))
        else:
            for j in range(m):
                sys.stdout.write((str(x1)+" "+str(m-j)+"\n"))
                sys.stdout.write((str(x2)+" "+str(j+1)+"\n"))