Boboniu likes playing chess with his employees. As we know, no employee can beat the boss in the chess game, so Boboniu has never lost in any round.

You are a new applicant for his company. Boboniu will test you with the following chess question:

Consider a $n\times m$ grid (rows are numbered from $1$ to $n$, and columns are numbered from $1$ to $m$). You have a chess piece, and it stands at some cell $(S_x,S_y)$ which is not on the border (i.e. $2 \le S_x \le n-1$ and $2 \le S_y \le m-1$).

From the cell $(x,y)$, you can move your chess piece to $(x,y')$ ($1\le y'\le m, y' \neq y$) or $(x',y)$ ($1\le x'\le n, x'\neq x$). In other words, the chess piece moves as a rook. From the cell, you can move to any cell on the same row or column.

Your goal is to visit each cell exactly once. Can you find a solution?

Note that cells on the path between two adjacent cells in your route are not counted as visited, and it is not required to return to the starting point.


-----Input-----

The only line of the input contains four integers $n$, $m$, $S_x$ and $S_y$ ($3\le n,m\le 100$, $2 \le S_x \le n-1$, $2 \le S_y \le m-1$) — the number of rows, the number of columns, and the initial position of your chess piece, respectively.


-----Output-----

You should print $n\cdot m$ lines.

The $i$-th line should contain two integers $x_i$ and $y_i$ ($1 \leq x_i \leq n$, $1 \leq y_i \leq m$), denoting the $i$-th cell that you visited. You should print exactly $nm$ pairs $(x_i, y_i)$, they should cover all possible pairs $(x_i, y_i)$, such that $1 \leq x_i \leq n$, $1 \leq y_i \leq m$.

We can show that under these constraints there always exists a solution. If there are multiple answers, print any.


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

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

Input
3 4 2 2

Output
2 2
2 1
2 3
2 4
1 4
3 4
3 3
3 2
3 1
1 1
1 2
1 3



-----Note-----

Possible routes for two examples: [Image]

Source: codeforces | Difficulty: EASY
Tags: Constructive algorithms


Solutions:
(n, m, x, y) = map(int, input().split())
print(x, y)
for i in range(1, m + 1):
	if i == y:
		continue
	print(x, i)
y_last = m
for i in range(1, n + 1):
	if i == x:
		continue
	if y_last == m:
		for j in range(m, 0, -1):
			print(i, j)
		y_last = 1
		continue
	if y_last == 1:
		for j in range(1, m + 1):
			print(i, j)
		y_last = m


(n, m, x, y) = map(int, input().split())
xx = int(x)
print(x, y)
i = 0
rev = False
flag = True
while i != n:
	for j in range(1, m + 1):
		if i == 0:
			if j != y:
				print(x, j)
		elif rev:
			print(x, m - (j - 1))
		else:
			print(x, j)
	if x > 1 and flag:
		x -= 1
	else:
		x = xx + 1
		xx += 1
		flag = False
	rev = not rev
	i += 1


def solve():
	(n, m, x, y) = list(map(int, input().split()))
	visited = set()
	print('{} {}'.format(x, y))
	visited.add((x, y))
	y = 1
	print('{} {}'.format(x, y))
	visited.add((x, y))
	top = True
	for col in range(1, m + 1):
		if top == True:
			for row in range(1, n + 1):
				if (row, col) not in visited:
					print('{} {}'.format(row, col))
					visited.add((row, col))
			top = False
		else:
			for row in range(n, 0, -1):
				if (row, col) not in visited:
					print('{} {}'.format(row, col))
					visited.add((row, col))
			top = True
solve()


(n, m, sx, sy) = map(int, input().split())
x = sx
y = sy
for i in range(n):
	for j in range(m):
		print(x, y)
		y += 1
		if y > m:
			y = 1
	x += 1
	y -= 1
	if y == 0:
		y = m
	if x > n:
		x = 1


import sys, collections
(n, m, x, y) = map(int, sys.stdin.readline().split())
q = collections.deque()
vis = [[False] * (m + 1) for _ in range(n + 1)]
q.append((x, y))
vis[x][y] = True
dx = [0, 1, 0, -1]
dy = [1, 0, -1, 0]
cnt = 0
while q:
	(cx, cy) = q.popleft()
	print(cx, cy)
	find = False
	for i in range(4):
		if find:
			break
		(nx, ny) = (cx, cy)
		while True:
			(nx, ny) = (nx + dx[i], ny + dy[i])
			if 1 <= nx <= n and 1 <= ny <= m:
				if vis[nx][ny] == False:
					vis[nx][ny] = True
					q.append((nx, ny))
					find = True
					break
			else:
				break


from sys import stdin
inp = lambda : stdin.readline().strip()
(m, n, y, x) = [int(x) for x in inp().split()]
i = 1
sy = y
for z in range(x, n + 1):
	print(y, z)
for z in range(x - 1, 0, -1):
	print(y, z)
y += 1
flag = True
while True:
	if i == 1:
		while i <= n:
			print(y, i)
			i += 1
	else:
		while i > 1:
			i -= 1
			print(y, i)
	if y == m:
		flag = False
		y = sy
	if y == 1:
		break
	if flag:
		y += 1
	else:
		y -= 1


import io
import os
from collections import Counter, defaultdict, deque

def solve(R, C, r0, c0):
	ans = []
	c = c0
	rs = list(range(R))
	rs.remove(r0)
	rs = [r0] + rs
	for r in rs:
		for i in range(C):
			ans.append(str(r + 1) + ' ' + str(c + 1))
			if i != C - 1:
				c = (c + 1) % C
	return '\n'.join(ans)
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
(N, M, X, Y) = [int(x) for x in input().split()]
X -= 1
Y -= 1
ans = solve(N, M, X, Y)
print(ans)


(n, m, x, y) = map(int, input().split())
k = y
while k > 0:
	print(f'{x} {k}')
	k -= 1
flag = False
i = x
j = y + 1
turn = 1
while i <= n and i > 0:
	if turn == 1 or turn % 2 != 0:
		if turn > 1:
			j = 1
		while j < m + 1:
			print(f'{i} {j}')
			j += 1
		turn += 1
	elif turn % 2 == 0:
		j = m
		while j > 0:
			print(f'{i} {j}')
			j -= 1
		turn += 1
	if flag == False:
		i += 1
	if i == n + 1:
		flag = True
		i = x - 1
		j = 1
	elif flag:
		i -= 1
		j = 1


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

def newposition(i, j):
	i = (i + x - 2) % n + 1
	j = (j + y - 2) % m + 1
	return str(i) + ' ' + str(j)
for i in range(1, n + 1):
	if i % 2 == 1:
		for j in range(1, m + 1):
			print(newposition(i, j))
	else:
		for j in range(m, 0, -1):
			print(newposition(i, j))


(n, m, x, y) = map(int, input().split())
indx = y
for i in range(x, n + 1):
	print(i, indx)
	for j in range(1, m + 1):
		if j == indx:
			continue
		else:
			print(i, j)
			indx2 = j
	indx = indx2
for i in range(1, x):
	print(i, indx)
	for j in range(1, m + 1):
		if j == indx:
			continue
		else:
			print(i, j)
			indx2 = j
	indx = indx2


(n, m, x, y) = map(int, input().split())
cnt = 0
(mix, mx, miy, my) = (0, x, 0, y)
for i in range(x, 0, -1):
	print(i, y)
for i in range(x + 1, n + 1):
	print(i, y)
ch = 1
for k in range(y + 1, m + 1):
	if ch:
		for j in range(n, 0, -1):
			print(j, k)
		ch ^= 1
	else:
		for j in range(1, n + 1):
			print(j, k)
		ch ^= 1
for k in range(y - 1, 0, -1):
	if ch:
		for j in range(n, 0, -1):
			print(j, k)
		ch ^= 1
	else:
		for j in range(1, n + 1):
			print(j, k)
		ch ^= 1


(n, m, sx, sy) = map(int, input().split())
print(sx, sy)
for i in range(sy - 1, 0, -1):
	print(sx, i)
for i in range(sy + 1, m + 1):
	print(sx, i)
c = 0
for i in range(sx - 1, 0, -1):
	if c % 2 == 1:
		for j in range(1, m + 1):
			print(i, j)
		c += 1
	else:
		for j in range(m, 0, -1):
			print(i, j)
		c += 1
for i in range(sx + 1, n + 1):
	if c % 2 == 1:
		for j in range(1, m + 1):
			print(i, j)
		c += 1
	else:
		for j in range(m, 0, -1):
			print(i, j)
		c += 1


(n, m, x, y) = map(int, input().split())
vis = [[0 for i in range(m + 2)] for j in range(n + 2)]
for i in range(m + 2):
	vis[0][i] = 1
	vis[n + 1][i] = 1
for i in range(n + 2):
	vis[i][0] = 1
	vis[i][m + 1] = 1
moves = [[x, y]]
vis[x][y] = 1
cc = 3
moves.append([1, y])
moves.append([1, 1])
vis[1][y] = 1
vis[1][1] = 1
(x, y) = (1, 1)
while cc < n * m:
	if x % 2 != 0:
		for i in range(1, m + 1):
			if vis[x][i] != 1:
				vis[x][i] = 1
				y = i
				moves.append([x, y])
				cc += 1
	else:
		for i in range(m, 0, -1):
			if vis[x][i] != 1:
				vis[x][i] = 1
				y = i
				moves.append([x, y])
				cc += 1
	x += 1
for i in moves:
	print(*i)


def cover(sx, sy):
	(x, y) = (sx, sy)
	while y != 1:
		y -= 1
		ans.append((x, y))
	if sy != m:
		y = sy
		while y != m:
			y += 1
			ans.append((x, y))
	return [x, y]
(n, m, sx, sy) = map(int, input().split())
(x, y) = (sx, sy)
ans = []
end = [sx + 1, sy]
while len(ans) < n * m:
	while end != [1, 1] and end != [1, m]:
		end[0] -= 1
		ans.append(end)
		end = cover(end[0], end[1])
	end = [sx, end[1]]
	while end != [n, 1] and end != [n, m]:
		end[0] += 1
		ans.append(end)
		end = cover(end[0], end[1])
for i in ans:
	print(i[0], i[1])


(n, m, x, y) = map(int, input().split())
curr_x = x
curr_y = y

def func(curr_x, curr_y):
	temp = None
	for i in range(curr_y, m + 1):
		print(curr_x, i)
		temp = i
	for i in range(1, curr_y):
		print(curr_x, i)
		temp = i
	curr_y = temp
	return (curr_x + 1, curr_y)
for i in range(curr_x, n + 1):
	(curr_x, curr_y) = func(curr_x, curr_y)
curr_x = 1
for i in range(1, x):
	(curr_x, curr_y) = func(curr_x, curr_y)


(n, m, p, q) = map(int, input().split())
print(p, q)
r = [x for x in range(p, n + 1)] + [x for x in range(1, p)]
c = [x for x in range(1, m + 1)]
for i in r:
	for j in c:
		if (i, j) != (p, q):
			print(i, j)
	c.reverse()


(n, m, x, y) = (int(x) for x in input().split())
for i in range(1, m + 1):
	print(x, y)
	for j in range(1, n + 1):
		if j == x:
			pass
		else:
			temp = j
			print(j, y)
	x = temp
	y = y % m + 1


lst = [0, 0, 4, 8]
mod = 10 ** 9 + 7
for i in range(4, 10 ** 6 + 1):
	lst.append(lst[-1] * 2 % mod)

def main(case):
	(n, m, x, y) = list(map(int, input().split()))
	line = str(x) + ' ' + str(y) + '\n'
	for i in range(1, m + 1):
		if i != y:
			line += str(x) + ' ' + str(i) + '\n'
	cur = -1
	for i in range(1, n + 1):
		if i != x:
			if cur == -1:
				for k in range(m, 0, -1):
					line += str(i) + ' ' + str(k) + '\n'
				cur = 1
			else:
				for k in range(1, m + 1):
					line += str(i) + ' ' + str(k) + '\n'
				cur = -1
	line.strip('\n')
	print(line)

def __starting_point():
	t = 1
	for i in range(t):
		main(i + 1)
__starting_point()


import sys

def input():
	return sys.stdin.readline().strip()

def move_forward(x, y, n, m, val_x, val_y):
	ind = y % 2
	while x <= n and y <= m:
		print(x, y)
		if y % 2 == ind:
			x -= val_x
		else:
			x += val_x
		if x == 1 or x == n:
			print(x, y)
			y += val_y

def move_backward(x, y, n, val_x):
	ind = y % 2
	if x == n:
		while y >= 1:
			print(x, y)
			y -= 1
	else:
		while x >= val_x and y >= 1:
			print(x, y)
			if y % 2 == ind:
				x += 1
			else:
				x -= 1
			if x == val_x or x == n:
				print(x, y)
				y -= 1
(n, m, x, y) = map(int, input().split())
move_forward(x, y, x, m, 1, 1)
move_backward(x + 1, m, n, x + 1)
move_forward(1, 1, x, y - 1, -1, 1)


def moveleft(s, e, r, steps):
	while s >= e:
		steps.append((r, s))
		s -= 1
	return (r, s)

def moveright(s, e, r, steps):
	while s <= e:
		steps.append((r, s))
		s += 1
	return (r, s)
(n, m, x, y) = map(int, input().split())
steps = []
fx = x
fy = y
(x, y) = moveleft(fy, 1, x, steps)
side = 0
if fy < m:
	(x, y) = moveright(fy + 1, m, x, steps)
	side = 1
x -= 1
while x > 0:
	if side:
		(x, y) = moveleft(m, 1, x, steps)
		side = 0
	else:
		(x, y) = moveright(1, m, x, steps)
		side = 1
	x -= 1
x = fx + 1
if y > m:
	side = 1
else:
	side = 0
while x <= n:
	if side:
		(x, y) = moveleft(m, 1, x, steps)
		side = 0
	else:
		(x, y) = moveright(1, m, x, steps)
		side = 1
	x += 1
for (a, b) in steps:
	print(a, end=' ')
	print(b)


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


import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
inin = lambda : int(input())
inar = lambda : list(map(int, input().split()))
inst = lambda : input().decode().rstrip('\n\r')
INF = float('inf')
_T_ = 1
for _t_ in range(_T_):
	(n, m, x, y) = inar()
	cx = x
	print(x, y)
	move = 1
	for j in range(y - 1, 0, -1):
		print(x, j)
	for j in range(y + 1, m + 1):
		print(x, j)
	while x < n:
		move = -move
		x += 1
		if move == -1:
			for j in range(m, 0, -1):
				print(x, j)
		if move == 1:
			for j in range(1, m + 1):
				print(x, j)
	x = 0
	while x < cx - 1:
		move = -move
		x += 1
		if move == -1:
			for j in range(m, 0, -1):
				print(x, j)
		if move == 1:
			for j in range(1, m + 1):
				print(x, j)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
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 IF(c, t, f):
	return t if c else f

def YES(c):
	return IF(c, 'YES', 'NO')

def main():
	t = 1
	rr = []
	for _ in range(t):
		(n, m, sx, sy) = LI()
		v = collections.defaultdict(bool)
		r = [(sx, sy)]
		v[sx, sy] = True
		for y in range(sy - 1, 0, -1):
			r.append((sx, y))
			v[sx, y] = True
		x = sx
		for y in range(1, m + 1):
			if y != 1:
				r.append((x, y))
				v[x, y] = True
			for xx in range(1, n + 1):
				if v[xx, y]:
					continue
				x = xx
				r.append((x, y))
				v[x, y] = True
		rr.append(JAA(r, '\n', ' '))
	return JA(rr, '\n')
print(main())


def chessruta(rows, columns, casilla_fila, casilla_columna, x):
	print(casilla_fila, casilla_columna)
	ultima = 0
	for i in range(1, columns + 1):
		if i == casilla_columna:
			continue
		else:
			print(casilla_fila, i)
			ultima = i
	if casilla_fila + 1 <= rows and casilla_fila + 1 != x:
		chessruta(rows, columns, casilla_fila + 1, ultima, x)
	elif casilla_fila + 1 == x:
		return
	else:
		chessruta(rows, columns, 1, ultima, x)
(rows, columns, casilla_fila, casilla_columna) = list(map(int, input().split()))
chessruta(rows, columns, casilla_fila, casilla_columna, casilla_fila)


def rook(n, m, x, y):
	print(x, y)
	flag = None
	for i in range(y - 2, -1, -1):
		print(x, i + 1)
		flag = False
	for i in range(y, m):
		print(x, i + 1)
		flag = True
	for i in range(x - 2, -1, -1):
		flag = not flag
		if not flag:
			for j in range(m - 1, -1, -1):
				print(i + 1, j + 1)
		else:
			for j in range(m):
				print(i + 1, j + 1)
	for i in range(x, n):
		flag = not flag
		if not flag:
			for j in range(m - 1, -1, -1):
				print(i + 1, j + 1)
		else:
			for j in range(m):
				print(i + 1, j + 1)
(n, m, x, y) = input().split()
rook(int(n), int(m), int(x), int(y))


import sys
input = sys.stdin.readline
from bisect import bisect_left
from bisect import bisect_right
from math import ceil, factorial

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

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

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

def int_array():
	return list(map(int, input().strip().split()))

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
(n, m, x, y) = int_array()
ans = []
x -= 1
y -= 1
px = x
while x != n:
	ans.append((x + 1, y + 1))
	x += 1
x -= 1
if px != 0:
	x = px - 1
	while x != -1:
		ans.append((x + 1, y + 1))
		x -= 1
	x += 1
px = x
py = y
y -= 1
while y != -1:
	if x == n - 1:
		while x != -1:
			ans.append((x + 1, y + 1))
			x -= 1
		x += 1
	else:
		while x != n:
			ans.append((x + 1, y + 1))
			x += 1
		x -= 1
	y -= 1
y = py + 1
while y != m:
	if x == n - 1:
		while x != -1:
			ans.append((x + 1, y + 1))
			x -= 1
		x += 1
	else:
		while x != n:
			ans.append((x + 1, y + 1))
			x += 1
		x -= 1
	y += 1
for i in ans:
	print(*i)


from sys import stdin
from collections import defaultdict, Counter
from bisect import bisect_left
from math import sqrt

def iinput():
	return int(stdin.readline())

def minput():
	return map(int, stdin.readline().split())

def linput():
	return list(map(int, stdin.readline().split()))
t = 1
while t:
	t -= 1
	(n, m, x, y) = minput()
	d = defaultdict(int)
	for i in range(x, 0, -1):
		print(i, y)
		d[i, y] = 1
	for i in range(1, m + 1):
		if d[1, i] == 0:
			print(1, i)
			d[1, i] = 1
	for row in range(2, n + 1):
		if row & 1:
			for col in range(1, m + 1):
				if d[row, col] == 0:
					print(row, col)
					d[row, col] = 1
		else:
			for col in range(m, 0, -1):
				if d[row, col] == 0:
					print(row, col)
					d[row, col] = 1


import sys
sys.setrecursionlimit(10 ** 5)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.readline())

def MI():
	return map(int, sys.stdin.readline().split())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def SI():
	return sys.stdin.readline()[:-1]
(h, w, sx, sy) = MI()
(i, j) = (sx - 1, sy - 1)
row = [False] * h
while row[i] == False:
	col = [False] * w
	while 1:
		print(i + 1, j + 1)
		col[j] = True
		if col[(j + 1) % w]:
			break
		j = (j + 1) % w
	row[i] = True
	i = (i + 1) % h


import sys

def answer(n, m, Sx, Sy):
	print(Sx, Sy)
	rptr = 0
	cols = [int(i) for i in range(1, m + 1, 1)]
	rows = [int(i) for i in range(Sx, 0, -1)]
	rows.extend([int(i) for i in range(Sx + 1, n + 1, 1)])
	for r in rows:
		for c in cols:
			if r == Sx and c == Sy:
				pass
			else:
				print(r, c)
		cols.reverse()
	return

def main():
	(n, m, Sx, Sy) = [int(i) for i in sys.stdin.readline().split()]
	answer(n, m, Sx, Sy)
	return
main()


from sys import stdin
input = stdin.readline
(n, m, a, b) = map(int, input().split())
s = [[a, b], [1, b]]
print(a, b)
print(1, b)
for x in range(1, n + 1):
	if x % 2 == 1:
		for y in range(1, m + 1):
			if [x, y] not in s:
				print(x, y)
	else:
		for y in range(m, 0, -1):
			if [x, y] not in s:
				print(x, y)


(n, m, x, y) = map(int, input().split())
l = [[0] * m] * n
ans = []
ans.append([x, y])
if x != 1:
	ans.append([1, y])
i = 0
while i < y - 1:
	ans.append([1, i + 1])
	i += 1
i = y
while i < m:
	ans.append([1, i + 1])
	i += 1
for i in range(1, n):
	if i % 2 != 0:
		for j in range(m - 1, -1, -1):
			if [i + 1, j + 1] != [x, y]:
				ans.append([i + 1, j + 1])
	elif i % 2 == 0:
		for j in range(0, m):
			if [i + 1, j + 1] != [x, y]:
				ans.append([i + 1, j + 1])
for i in range(len(ans)):
	print(*ans[i])


from sys import stdin
input = stdin.buffer.readline
(n, m, x, y) = map(int, input().split())
print(x, y)
print(1, y)
i = j = c = 1
while i <= n:
	if c:
		while j <= m:
			if (i, j) not in [(x, y), (1, y)]:
				print(i, j)
			j += 1
		j -= 1
	else:
		while j >= 1:
			if (i, j) not in [(x, y), (1, y)]:
				print(i, j)
			j -= 1
		j += 1
	i += 1
	c ^= 1


(N, M, x, y) = map(int, input().split())
x -= 1
y -= 1
rev = False
print(x + 1, y + 1)
if not x:
	rev = True
if not rev:
	for i in range(N - 1, -1, -1):
		if i != x:
			print(i + 1, y + 1)
else:
	for i in range(1, N):
		print(i + 1, y + 1)
for i in range(N - 1, -1, -1) if rev else range(0, N):
	for j in range(0, M) if i % 2 else range(M - 1, -1, -1):
		if j != y:
			print(i + 1, j + 1)


import os
import sys
import math
import heapq
from decimal import *
from io import BytesIO, IOBase
from collections import defaultdict, deque

def r():
	return int(input())

def rm():
	return list(map(int, input().split()))

def rl():
	return list(map(int, input().split()))
(n, m, x, y) = rm()
print(x, y)
print(1, y)
go = True
for i in range(1, n + 1):
	if go:
		for j in range(1, m + 1):
			if i == x and j == y or (i == 1 and j == y):
				continue
			print(i, j)
	else:
		for j in range(m, 0, -1):
			if i == x and j == y or (i == 1 and j == y):
				continue
			print(i, j)
	go = not go


(n, m, x, y) = [int(x) for x in input().split()]
print(x, y)
print(x, 1)
for j in range(1, m + 1):
	if j % 2 == 1:
		for i in range(1, n + 1):
			if i != x:
				print(i, j)
			elif j != 1 and j != y:
				print(i, j)
	else:
		for i in range(n, 0, -1):
			if j == y and i == x:
				continue
			else:
				print(i, j)


(m, n, x, y) = map(int, input().split())
for i in range(m):
	if not i & 1:
		for j in range(n):
			print((x + i - 1) % m + 1, (y + j - 1) % n + 1)
	else:
		for j in range(n - 1, -1, -1):
			print((x + i - 1) % m + 1, (y + j - 1) % n + 1)


from collections import defaultdict
from math import *
import os
import sys
from io import BytesIO, IOBase
from heapq import nlargest
from bisect import *
import copy
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')
(n, m, x, y) = map(int, input().split())
print(x, y)
z = y
for i in range(z - 1, m):
	print('1', i + 1)
for j in range(z - 2, -1, -1):
	print('1', j + 1)
for i in range(2, n + 1):
	if i % 2 == 0:
		for j in range(1, m + 1):
			if i != x or j != y:
				print(i, j)
	else:
		for j in range(m, 0, -1):
			if i != x or j != y:
				print(i, j)


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

def visit_all_cell(n, m, x, y, orin_x, orin_y):
	print(x, y)
	x += 1
	if x > n:
		x = 1
	while x != orin_x:
		print(x, y)
		x += 1
		if x > n:
			x = 1
	x -= 1
	if x == 0:
		x = n
	y += 1
	if y > m:
		y = 1
	if y == orin_y:
		return
	visit_all_cell(n, m, x, y, x, orin_y)
visit_all_cell(n, m, x, y, x, y)


(n, m, a, b) = map(int, input().split())
print(a, b)
for j in range(m):
	if j != b - 1:
		print(a, j + 1)
b = m
for i in range(n):
	if i != a - 1:
		print(i + 1, b)
		for j in range(m):
			if j + 1 != b:
				print(i + 1, j + 1)
		if j + 1 != b:
			b = m
		else:
			b = m - 1


import os
import sys
from io import BytesIO, IOBase
from collections import Counter, defaultdict
from collections import deque
from functools import cmp_to_key
import math

def sin():
	return input()

def ain():
	return list(map(int, sin().split()))

def sain():
	return input().split()

def iin():
	return int(sin())
MAX = float('inf')
MIN = float('-inf')
MOD = 1000000007

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	s = set()
	for p in range(2, n + 1):
		if prime[p]:
			s.add(p)
	return s

def readTree(n, m):
	adj = [deque([]) for _ in range(n + 1)]
	for _ in range(m):
		(u, v) = ain()
		adj[u].append(v)
		adj[v].append(u)
	return adj

def main():
	(n, m, x, y) = ain()
	print(x, y)
	for i in range(1, m + 1):
		if y != i:
			print(x, i)
	c = 0
	for i in range(x + 1, n + 1):
		if c == 0:
			for j in range(m, 0, -1):
				print(i, j)
			c = 1 - c
		else:
			for j in range(1, m + 1):
				print(i, j)
			c = 1 - c
	for i in range(x - 1, 0, -1):
		if c == 0:
			for j in range(m, 0, -1):
				print(i, j)
			c = 1 - c
		else:
			for j in range(1, m + 1):
				print(i, j)
			c = 1 - c
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
if os.getcwd() == 'D:\\code':
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
	input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


(n, m, x, y) = map(int, input().split())
cols = set(range(1, m + 1)) - {y}
print(x, y)
for i in cols:
	y = i
	print(x, y)
lines = set(range(1, n + 1)) - {x}
for i in lines:
	x = i
	print(x, y)
	cols = set(range(1, m + 1)) - {y}
	for j in cols:
		y = j
		print(x, y)


(n, m, sx, sy) = [int(x) for x in input().split()]
for i in range(sy, 0, -1):
	print(sx, end=' ')
	print(i)
for i in range(sy + 1, m + 1):
	print(sx, end=' ')
	print(i)
x = 'r'
for i in range(1, n + 1):
	if sx - i > 0:
		if x == 'r':
			for j in range(m, 0, -1):
				print(sx - i, end=' ')
				print(j)
			x = 'l'
		elif x == 'l':
			for j in range(1, m + 1):
				print(sx - i, end=' ')
				print(j)
			x = 'r'
	if sx + i <= n:
		if x == 'l':
			for j in range(1, m + 1):
				print(sx + i, end=' ')
				print(j)
			x = 'r'
		elif x == 'r':
			for j in range(m, 0, -1):
				print(sx + i, end=' ')
				print(j)
			x = 'l'


import sys
nmxy = list(map(int, sys.stdin.readline().split()))
sys.stdout.write(str(nmxy[2]) + ' ' + str(nmxy[3]) + '\n')
sys.stdout.write('1 ' + str(nmxy[3]) + '\n')
for x0 in range(1, nmxy[0] + 1):
	for y0 in range(1, nmxy[1] + 1):
		y1 = y0
		if x0 % 2 == 1:
			y1 = nmxy[1] + 1 - y0
		if not (y1 == nmxy[3] and (x0 == 1 or x0 == nmxy[2])):
			sys.stdout.write(str(x0) + ' ' + str(y1) + '\n')


from sys import stdin

def inp():
	return stdin.buffer.readline().rstrip().decode('utf8')

def itg():
	return int(stdin.buffer.readline())

def mpint():
	return map(int, stdin.buffer.readline().split())
(n, m, sx, sy) = mpint()
start = (sx, sy)
top = (sx, 1)
print(sx, sy)
print(sx, 1)
print(1, 1)
(sx, sy) = (1, 1)
go_right = True
for i in range(n * m - 1):
	if go_right:
		sx += 1
	else:
		sx -= 1
	if sx > n:
		sx -= 1
		sy += 1
		go_right ^= 1
	elif sx < 1:
		sx += 1
		sy += 1
		go_right ^= 1
	if (sx, sy) == start or (sx, sy) == top:
		continue
	print(sx, sy)


(row, col, posX, posY) = map(int, input().split())
for k in range(posY, col + 1):
	print(posX, k)
for k in range(posY - 1, 0, -1):
	print(posX, k)
isStart = True
for i in range(1, row + 1):
	if i == posX:
		continue
	if isStart == True:
		for j in range(1, col + 1):
			print(i, j)
		isStart = False
	elif isStart == False:
		for j in range(col, 0, -1):
			print(i, j)
		isStart = True


def modinv(n, p):
	return pow(n, p - 2, p)

def main():
	(n, m, x, y) = [int(x) for x in input().split()]
	print(x, y)
	if x != 1:
		print(1, y)
	if y != 1:
		print(1, 1)
	i = 1
	while i <= n:
		if i % 2 == 1:
			for j in range(1, m + 1):
				if [i, j] not in [[x, y], [1, y], [1, 1]]:
					print(i, j)
		else:
			for j in range(m, 0, -1):
				if [i, j] not in [[x, y], [1, y], [1, 1]]:
					print(i, j)
		i += 1
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


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


(n, m, x, y) = map(int, input().split())
for i in range(y, 0, -1):
	print(x, i)
for i in range(y + 1, m + 1):
	print(x, i)
level = 0
for i in range(x + 1, n + 1):
	if level == 0:
		for j in range(m, 0, -1):
			print(i, j)
		level = 1
	else:
		level = 0
		for j in range(1, m + 1):
			print(i, j)
	if i == n:
		check = [i, j]
level = 1
if check[1] == 1:
	for i in range(x - 1, 0, -1):
		if level == 0:
			for j in range(m, 0, -1):
				print(i, j)
			level = 1
		else:
			level = 0
			for j in range(1, m + 1):
				print(i, j)
else:
	level = 0
	for i in range(x - 1, 0, -1):
		if level == 0:
			for j in range(m, 0, -1):
				print(i, j)
			level = 1
		else:
			level = 0
			for j in range(1, m + 1):
				print(i, j)


def readn():
	return int(input())

def readlist():
	return list(map(int, input().split()))

def readnos():
	return map(int, input().split())
(n, m, x, y) = map(int, input().split())
for i in range(y, 0, -1):
	print(x, i, sep=' ')
for i in range(y + 1, m + 1):
	print(x, i, sep=' ')
cnt = 0
for i in range(x - 1, 0, -1):
	if cnt % 2 == 0:
		for j in range(m, 0, -1):
			print(i, j, sep=' ')
	else:
		for j in range(1, m + 1):
			print(i, j, sep=' ')
	cnt += 1
if j == 1:
	cnt = 0
	for i in range(x + 1, n + 1):
		if cnt % 2 == 0:
			for j in range(1, m + 1):
				print(i, j, sep=' ')
		else:
			for j in range(m, 0, -1):
				print(i, j, sep=' ')
		cnt += 1
else:
	cnt = 0
	for i in range(x + 1, n + 1):
		if cnt % 2 == 0:
			for j in range(m, 0, -1):
				print(i, j, sep=' ')
		else:
			for j in range(1, m + 1):
				print(i, j, sep=' ')
		cnt += 1


(n, m, x, y) = map(int, input().split())
for i in range(x, n + 1):
	print(i, y)
for i in range(x - 1, 0, -1):
	print(i, y)
k = 1
for i in range(y + 1, m + 1):
	if k == 1:
		for j in range(1, n + 1):
			print(j, i)
			k = 0
	elif k == 0:
		for j in range(n, 0, -1):
			print(j, i)
			k = 1
for i in range(y - 1, 0, -1):
	if k == 1:
		for j in range(1, n + 1):
			print(j, i)
			k = 0
	elif k == 0:
		for j in range(n, 0, -1):
			print(j, i)
			k = 1


def solve(n, m, sx, sy):
	track = [[sx, sy]]
	for j in range(1, m + 1):
		if j == sy:
			continue
		track.append([sx, j])
	left = True
	row = [0] * (n + 1)
	row[sx] = 1
	for i in range(1, n + 1):
		if row[i] == 1:
			continue
		if left:
			for j in range(m, 0, -1):
				track.append([i, j])
			left = False
		else:
			for j in range(1, m + 1):
				track.append([i, j])
			left = True
	for (i, j) in track:
		print(i, j)
(n, m, sx, sy) = map(int, input().split())
solve(n, m, sx, sy)


(n, m, sx, sy) = map(int, input().split())
used = [[False] * m for i in range(n)]
print(sx, sy)
for j in range(1, sy):
	print(sx, j)
for j in range(sy + 1, m + 1):
	print(sx, j)
for i in range(n, 0, -1):
	if i != sx:
		print(i, m)
j = m - 1
k = 0
while j:
	k += 1
	if k % 2 == 1:
		for i in range(1, n + 1):
			if i != sx:
				print(i, j)
	else:
		for i in range(n, 0, -1):
			if i != sx:
				print(i, j)
	j -= 1


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


import time
from collections import deque

def inpt():
	return int(input())

def inpl():
	return list(map(int, input().split()))

def inpm():
	return map(int, input().split())

def solve():
	(n, m, x, y) = inpm()
	l = []
	while x >= 1:
		print(x, y)
		l.append([x, y])
		x -= 1
	y -= 1
	while y >= 1:
		print(1, y)
		l.append([1, y])
		y -= 1
	i = 1
	j = 1
	while i <= n:
		while j <= m:
			if [i, j] not in l:
				print(i, j)
			j += 1
		i += 1
		if i > n:
			break
		j = m
		while j >= 1:
			if [i, j] not in l:
				print(i, j)
			j -= 1
		i += 1
		j = 1

def main():
	m = 10 ** 9 + 7
	solve()
main()


(w, h, sx, sy) = map(int, input().split())
for x in range(sx, w + 1):
	for y in range(sy, h + 1):
		print(x, y)
	for y in range(1, sy):
		print(x, y)
	sy = y
for x in range(1, sx):
	for y in range(sy, h + 1):
		print(x, y)
	for y in range(1, sy):
		print(x, y)
	sy = y


import sys
import math

def II():
	return int(sys.stdin.readline())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def MI():
	return map(int, sys.stdin.readline().split())

def SI():
	return sys.stdin.readline().strip()
(n, m, x, y) = MI()
d = []
for i in range(n):
	d.append([0] * m)
d[x - 1][y - 1] = 1
ans = [[x, y]]
d[0][y - 1] = 1
ans.append([1, y])
for i in range(n):
	for j in range(m):
		if i % 2 == 0:
			if d[i][j] != 1:
				d[i][j] == 1
				ans.append([i + 1, j + 1])
		elif d[i][m - 1 - j] != 1:
			d[i][m - 1 - j] == 1
			ans.append([i + 1, m - 1 - j + 1])
for i in ans:
	print(*i)


(n, m, x, y) = map(int, input().split(' '))
print(x, y)
for i in range(m, 0, -1):
	if i == y:
		continue
	print(x, i)
for row in range(1, n + 1):
	if row == x:
		continue
	if row < x:
		if row % 2 == 0:
			for i in range(m, 0, -1):
				print(row, i)
		else:
			for i in range(1, m + 1):
				print(row, i)
	elif row % 2 == 1:
		for i in range(m, 0, -1):
			print(row, i)
	else:
		for i in range(1, m + 1):
			print(row, i)


(n, m, x, y) = map(int, input().split())
(x, y) = (y, x)
for i in range(x, m + 1):
	xi = i % m
	if xi == 0:
		xi = m
	print(y, xi)
for i in range(x - 1, 0, -1):
	xi = i % m
	if xi == 0:
		xi = m
	print(y, xi)
flag = 1
for i in range(y + 1, n + y):
	row = i % n
	if row == 0:
		row = n
	if flag == 1:
		for i in range(1, m + 1):
			print(row, i)
	elif flag == -1:
		for i in range(m, 0, -1):
			print(row, i)
	flag *= -1


(n, m, x, y) = map(int, [*open(0)][0].split())
(x, y) = (x - 1, y - 1)
for i in range(n):
	print(x + 1, y + 1)
	for j in range(m - 1):
		y = (y + 1) % m
		print(x + 1, y + 1)
	x = (x + 1) % n


[n, m, sx, sy] = map(int, input().split())
moves = [(sx, sy), (sx, 1), (1, 1)]
visited = set(moves)
pos = (1, 1)
direction = 'down'
cnt = 1
while cnt != n * m:
	cnt += 1
	(x, y) = pos
	if direction == 'down':
		if x == n:
			pos = (x, y + 1)
			direction = 'up'
		else:
			pos = (x + 1, y)
	elif x == 1:
		pos = (x, y + 1)
		direction = 'down'
	else:
		pos = (x - 1, y)
	if pos not in visited:
		moves.append(pos)
for (x, y) in moves:
	print(x, y)


(n, m, sx, sy) = map(int, input().split())
p = 0
if sy == m:
	p = 1 - p
for r in range(n + 1):
	if r == sx:
		p = 1 - p
		continue
	for c in range(m):
		if r == 0:
			if c == 0:
				print(str(sx) + ' ' + str(sy))
			elif c < sy:
				print(str(sx) + ' ' + str(c))
			else:
				print(str(sx) + ' ' + str(c + 1))
		elif r % 2 == p:
			print(str(r) + ' ' + str(c + 1))
		else:
			print(str(r) + ' ' + str(m - c))


(x, y, n, m) = map(int, input().split())
ch = [[0] * y for _ in range(x)]
(a, b) = (n - 1, m - 1)
for _ in range(x * y):
	if ch[a][b]:
		a += 1
		a %= x
		b = (b + y - 1) % y
		ch[a][b] = 1
		print(a + 1, b + 1)
	else:
		ch[a][b] = 1
		print(a + 1, b + 1)
	b += 1
	b %= y


t = 1
ans = []

def solve(n, m, x, y):
	ans = []
	one = (x, y)
	two = (1, y)
	three = (1, 1)
	print(one[0], one[1])
	print(two[0], two[1])
	print(three[0], three[1])
	for x1 in range(1, n + 1):
		row = []
		for y1 in range(1, m + 1):
			if (x1, y1) == one or (x1, y1) == two or (x1, y1) == three:
				continue
			row.append((x1, y1))
		if x1 % 2 == 0:
			ans.append(row[::-1])
		else:
			ans.append(row)
	return ans
for i in range(t):
	s = [int(x) for x in input().split()]
	n = s[0]
	m = s[1]
	x = s[2]
	y = s[3]
	a = solve(n, m, x, y)
	for l in a:
		for z in l:
			print(z[0], z[1])


(a, b, c, d) = map(int, input().split())
for j in range(d, b + 1):
	print(c, j)
for j in range(d - 1, 0, -1):
	print(c, j)
for j in range(c + 1, a + 1):
	if c % 2 == 0 and j % 2 != 0 or (c % 2 != 0 and j % 2 == 0):
		for k in range(1, b + 1):
			print(j, k)
	else:
		for k in range(b, 0, -1):
			print(j, k)
e = k
for j in range(1, c):
	if j % 2 != 0:
		if e == b:
			for k in range(b, 0, -1):
				print(j, k)
		else:
			for k in range(1, b + 1):
				print(j, k)
	elif e == b:
		for k in range(1, b + 1):
			print(j, k)
	else:
		for k in range(b, 0, -1):
			print(j, k)


(n, m, sx, sy) = map(int, input().split())
print(sx, sy)
print(n, sy)
for i in range(sy + 1, m + 1):
	print(n, i)
for i in range(sy - 1, 0, -1):
	print(n, i)
di = 1
for i in range(n - 1, 0, -1):
	for j in range(1, m + 1):
		if di == 1 and (i != sx or j != sy):
			print(i, j)
		elif di == 0 and (i != sx or sy != m + 1 - j):
			print(i, m + 1 - j)
	di = abs(di - 1)


from collections import deque as dq
from collections import defaultdict as dd
from collections import Counter as ct
from functools import lru_cache as lc
from heapq import heappush as hpush, heappop as hpop, heapify as hfy
from bisect import bisect_left, bisect_right
import itertools as it
import math
import sys
input = sys.stdin.readline

def solve():
	(N, M, Sx, Sy) = map(int, input().split())
	(cx, cy) = (Sx, Sy)
	visited = [[False] * (M + 1) for i in range(N + 1)]
	print(cx, cy)
	visited[cx][cy] = True
	cnt = 1
	while cnt < N * M:
		for i in range(1, N + 1):
			if not visited[i][cy]:
				visited[i][cy] = True
				cx = i
				cnt += 1
				print(cx, cy)
				break
		else:
			for i in range(1, M + 1):
				if not visited[cx][i]:
					visited[cx][i] = True
					cy = i
					cnt += 1
					print(cx, cy)
					break
t = 1
for i in range(t):
	solve()


import sys
input = sys.stdin.readline
(n, m, x, y) = list(map(int, input().split(' ')))
d = {}
cx = x
cy = y
for i in range(x):
	print(x - i, y)
	cx = x - i
	cy = y
for i in range(x + 1, n + 1):
	print(i, y)
	cx = i
	cy = y
x = cx
y = cy
if cx == 1:
	f = 0
else:
	f = -1
for i in range(y + 1, m + 1):
	if f == -1:
		for j in range(n, 0, -1):
			print(j, i)
			cx = j
			cy = i
		f = 0
	elif f == 0:
		for j in range(1, n + 1):
			print(j, i)
			cx = j
			cy = i
		f = -1
if cx == 1:
	f = 0
else:
	f = -1
for i in range(1, y):
	if f == -1:
		for j in range(n, 0, -1):
			print(j, i)
			cx = j
			cy = i
		f = 0
	elif f == 0:
		for j in range(1, n + 1):
			print(j, i)
			cx = j
			cy = i
		f = -1


(n, m, sx, sy) = input().split()
n = int(n)
m = int(m)
sx = int(sx) - 1
sy = int(sy) - 1
j = sy
while j < m:
	print(sx + 1, end=' ')
	print(j + 1)
	j += 1
j = sy - 1
while j >= 0:
	print(sx + 1, end=' ')
	print(j + 1)
	j -= 1
i = sx - 1
j = 0
while i >= 0:
	if j == 0:
		for j in range(m):
			print(i + 1, end=' ')
			print(j + 1)
	else:
		while j >= 0:
			print(i + 1, end=' ')
			print(j + 1)
			j -= 1
		j += 1
	i -= 1
i = sx + 1
while i < n:
	if j == 0:
		for j in range(m):
			print(i + 1, end=' ')
			print(j + 1)
	else:
		while j >= 0:
			print(i + 1, end=' ')
			print(j + 1)
			j -= 1
		j += 1
	i += 1


(n, m, x, y) = list(map(int, input().split()))
x -= 1
y -= 1
ans = []
for i in range(y, m):
	ans.append([x, i])
for i in range(y - 1, -1, -1):
	ans.append([x, i])
rev = False
for j in range(x + 1, n):
	if rev == False:
		for i in range(m):
			ans.append([j, i])
		rev = True
	else:
		for i in range(m - 1, -1, -1):
			ans.append([j, i])
		rev = False
for j in range(x - 1, -1, -1):
	if rev == False:
		for i in range(m):
			ans.append([j, i])
		rev = True
	else:
		for i in range(m - 1, -1, -1):
			ans.append([j, i])
		rev = False
for i in ans:
	(a, b) = i
	print(a + 1, b + 1)


import sys
from decimal import Decimal
import math
from collections import Counter
import bisect
from itertools import combinations
MOD = 10 ** 6 + 7
INF = 10 ** 9
PI = 3.141592653589793

def read_str():
	return sys.stdin.readline().strip()

def read_int():
	return int(sys.stdin.readline().strip())

def read_ints():
	return map(int, sys.stdin.readline().strip().split())

def read_str_list():
	return list(sys.stdin.readline().strip().split())

def read_int_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def lcm(a: int, b: int) -> int:
	return a * b // math.gcd(a, b)
dx = [0, 1, 0, -1]
dy = [1, 0, -1, 0]

def bfs(n, m, grid, dist, nowx, nowy):
	if grid[nowy][nowx] == dist:
		return
	for i in range(4):
		nx = nowx + dx[i]
		ny = nowy + dy[i]
		if 0 <= ny < n and 0 <= nx < m and (grid[ny][nx] == 0):
			grid[ny][nx] = grid[nowy][nowx] + 1
			bfs(n, m, grid, dist, nx, ny)

def Main():
	(n, m, sx, sy) = read_ints()
	sx -= 1
	sy -= 1
	for i in range(n):
		for j in range(m - 1):
			print(sx + 1, sy + 1)
			sy += 1
			sy %= m
		print(sx + 1, sy + 1)
		sx += 1
		sx %= n
Main()


(n, m, sx, sy) = map(int, input().split())
print(sx, sy)
for i in range(2, sy):
	print(sx, i)
for i in range(sy + 1, m + 1):
	print(sx, i)
print(sx, 1)
rev = 0
for r in range(1, n + 1):
	if r == sx:
		continue
	elif rev:
		for c in range(m, 0, -1):
			print(r, c)
		rev = 0
	else:
		for c in range(1, m + 1):
			print(r, c)
		rev = 1


import os
import sys
from io import BytesIO, IOBase
import threading
from math import factorial as fac
from collections import deque, defaultdict

def main():
	(n, m, sx, sy) = map(int, input().split())
	visited = [(1, sy), (1, 1), (sx, sy)]
	print(f'{sx} {sy}')
	print(f'{1} {sy}')
	print(f'{1} {1}')
	increase = False
	col = m
	for i in range(1, n + 1):
		if i % 2 == 0:
			col = m
			increase = False
		else:
			col = 1
			increase = True
		for _ in range(1, m + 1):
			if (i, col) not in visited:
				print(f'{i} {col}')
			if increase:
				col += 1
			else:
				col -= 1
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


(n, m, x, y) = map(int, input().split())
x = x - 1
y = y - 1
s = set()
l = [[x + 1, y + 1]]
s.add((x + 1, y + 1))
for i in range(x - 1, -1, -1):
	a = [i + 1, y + 1]
	l.append(a)
	s.add(tuple(a))
for i in range(y - 1, -1, -1):
	a = [1, i + 1]
	if not tuple(a) in s:
		l.append(a)
		s.add(tuple(a))
for i in range(y + 1, m):
	a = [1, i + 1]
	if not tuple(a) in s:
		l.append(a)
		s.add(tuple(a))
flag = 1
for i in range(1, n):
	if flag:
		for j in range(m - 1, -1, -1):
			a = [i + 1, j + 1]
			if not tuple(a) in s:
				l.append(a)
				s.add(tuple(a))
		flag = 0
	else:
		for j in range(0, m):
			a = [i + 1, j + 1]
			if not tuple(a) in s:
				l.append(a)
				s.add(tuple(a))
		flag = 1
for i in l:
	print(i[0], i[1])


import sys, bisect, string, math, time, functools, random, fractions
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
from itertools import permutations, combinations, groupby
rep = range
R = range

def Golf():
	(n, *t) = map(int, open(0).read().split())

def I():
	return int(input())

def S_():
	return input()

def IS():
	return input().split()

def LS():
	return [i for i in input().split()]

def MI():
	return map(int, input().split())

def LI():
	return [int(i) for i in input().split()]

def LI_():
	return [int(i) - 1 for i in input().split()]

def NI(n):
	return [int(input()) for i in range(n)]

def NI_(n):
	return [int(input()) - 1 for i in range(n)]

def StoLI():
	return [ord(i) - 97 for i in input()]

def ItoS(n):
	return chr(n + 97)

def LtoS(ls):
	return ''.join([chr(i + 97) for i in ls])

def RA():
	return map(int, open(0).read().split())

def RLI(n=8, a=1, b=10):
	return [random.randint(a, b) for i in range(n)]

def RI(a=1, b=10):
	return random.randint(a, b)

def Rtest(T):
	(case, err) = (0, 0)
	for i in range(T):
		inp = INP()
		(a1, ls) = naive(*inp)
		a2 = solve(*inp)
		if a1 != a2:
			print((a1, a2), inp)
			err += 1
		case += 1
	print('Tested', case, 'case with', err, 'errors')

def GI(V, E, ls=None, Directed=False, index=1):
	org_inp = []
	g = [[] for i in range(V)]
	FromStdin = True if ls == None else False
	for i in range(E):
		if FromStdin:
			inp = LI()
			org_inp.append(inp)
		else:
			inp = ls[i]
		if len(inp) == 2:
			(a, b) = inp
			c = 1
		else:
			(a, b, c) = inp
		if index == 1:
			a -= 1
			b -= 1
		aa = (a, c)
		bb = (b, c)
		g[a].append(bb)
		if not Directed:
			g[b].append(aa)
	return (g, org_inp)

def GGI(h, w, search=None, replacement_of_found='.', mp_def={'#': 1, '.': 0}, boundary=1):
	mp = [boundary] * (w + 2)
	found = {}
	for i in R(h):
		s = input()
		for char in search:
			if char in s:
				found[char] = (i + 1) * (w + 2) + s.index(char) + 1
				mp_def[char] = mp_def[replacement_of_found]
		mp += [boundary] + [mp_def[j] for j in s] + [boundary]
	mp += [boundary] * (w + 2)
	return (h + 2, w + 2, mp, found)

def TI(n):
	return GI(n, n - 1)

def accum(ls):
	rt = [0]
	for i in ls:
		rt += [rt[-1] + i]
	return rt

def bit_combination(n, base=2):
	rt = []
	for tb in R(base ** n):
		s = [tb // base ** bt % base for bt in R(n)]
		rt += [s]
	return rt

def gcd(x, y):
	if y == 0:
		return x
	if x % y == 0:
		return y
	while x % y != 0:
		(x, y) = (y, x % y)
	return y

def YN(x):
	print(['NO', 'YES'][x])

def Yn(x):
	print(['No', 'Yes'][x])

def show(*inp, end='\n'):
	if show_flg:
		print(*inp, end=end)
mo = 10 ** 9 + 7
inf = float('inf')
FourNb = [(-1, 0), (1, 0), (0, 1), (0, -1)]
EightNb = [(-1, 0), (1, 0), (0, 1), (0, -1), (1, 1), (-1, -1), (1, -1), (-1, 1)]
compas = dict(zip('WENS', FourNb))
cursol = dict(zip('LRUD', FourNb))
l_alp = string.ascii_lowercase
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
input = lambda : sys.stdin.readline().rstrip()
show_flg = False
show_flg = True
ans = 0
ans = 0
(n, m, sx, sy) = LI()
(h, w) = (sx, sy)
print(h, w)
w = 1
for i in range(m - 1):
	if w == sy:
		w += 1
	print(h, w)
	w += 1
w -= 1
h = 1
for j in range(n - 1):
	if h == sx:
		h += 1
	for i in range(m):
		print(h, w)
		w += 1
		if w == m + 1:
			w = 1
	h += 1
	w -= 1
	if w == 0:
		w = m


import math
(n, m, x, y) = map(int, input().split())
print(x, y)
x -= 1
y -= 1
arr = [[0] * m for i in range(n)]
arr[x][y] = 1
c = 2
for i in range(y - 1, -1, -1):
	arr[x][i] = c
	print(x + 1, i + 1)
	c += 1
for i in range(y + 1, m):
	arr[x][i] = c
	print(x + 1, i + 1)
	c += 1
b = m - 1
for i in range(x + 1, n):
	if b == m - 1:
		for j in range(m - 1, -1, -1):
			arr[i][j] = c
			print(i + 1, j + 1)
			c += 1
		b = 0
	else:
		for j in range(m):
			arr[i][j] = c
			print(i + 1, j + 1)
			c += 1
		b = m - 1
for i in range(x - 1, -1, -1):
	if b == m - 1:
		for j in range(m - 1, -1, -1):
			arr[i][j] = c
			print(i + 1, j + 1)
			c += 1
		b = 0
	else:
		for j in range(m):
			arr[i][j] = c
			print(i + 1, j + 1)
			c += 1
		b = m - 1


import sys
input = sys.stdin.readline
(n, m, x, y) = map(int, input().split())
x -= 1
y -= 1
ans = []
for _ in range(n):
	for j in range(m):
		ans.append((x + 1, y + 1))
		if j != m - 1:
			y = (y + 1) % m
		else:
			x = (x + 1) % n
for (x, y) in ans:
	print(x, y)


import sys
import math
input = sys.stdin.readline
UP_MODE = 0
LEFT_MODE_ROW0 = 1
LEFT_MODE = 2
RIGHT_MODE = 3
(n, m, x, y) = list(map(int, input().split(' ')))
A = [[False for column in range(m)] for row in range(n)]
x -= 1
y -= 1
visited = 0
total = n * m
mode = UP_MODE
while visited < total:
	print(x + 1, y + 1)
	A[x][y] = True
	visited += 1
	if mode == UP_MODE:
		x = 0
		mode = LEFT_MODE_ROW0
	elif mode == LEFT_MODE:
		while A[x][y] and y:
			y -= 1
		if A[x][y]:
			x += 1
			mode = RIGHT_MODE
	elif mode == RIGHT_MODE:
		while A[x][y] and y < m - 1:
			y += 1
		if A[x][y]:
			x += 1
			mode = LEFT_MODE
	elif mode == LEFT_MODE_ROW0:
		while A[x][y] and y:
			y -= 1
		if A[x][y]:
			while A[x][y] and y < m - 1:
				y += 1
			mode = RIGHT_MODE


(n, m, x, y) = map(int, input().split())
arr = [[0] * m] * n
arr[x - 1][y - 1] = 1
arr[0][y - 1] = 1
print(x, y)
print(1, y)
p = 0
for i in range(0, len(arr)):
	for j in range(0, len(arr[0])):
		if i % 2 == 1:
			j = len(arr[0]) - j - 1
		trr = [i, j]
		if not (trr == [x - 1, y - 1] or trr == [0, y - 1]):
			print(i + 1, j + 1)


randid = 'drnweur'
(m, n, stx, sty) = map(int, input().split())
print(stx, sty)
cx = stx
lvx = stx
for cy in range(1, n + 1):
	jx = cx
	while cx <= m:
		if cx != stx or cy != sty:
			print(cx, cy)
		cx += 1
	if cx >= m:
		cx = m
	if jx > 1:
		cx = jx - 1
		while cx > 0:
			if cx != stx or cy != sty:
				print(cx, cy)
			cx -= 1
		cx = 1


import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub
import sys
buff_readline = sys.stdin.readline
readline = sys.stdin.readline
INF = 2 ** 62 - 1

def read_int():
	return int(buff_readline())

def read_int_n():
	return list(map(int, buff_readline().split()))

def read_float():
	return float(buff_readline())

def read_float_n():
	return list(map(float, buff_readline().split()))

def read_str():
	return readline().strip()

def read_str_n():
	return readline().strip().split()

def error_print(*args):
	print(*args, file=sys.stderr)

def mt(f):
	import time

	def wrap(*args, **kwargs):
		s = time.time()
		ret = f(*args, **kwargs)
		e = time.time()
		error_print(e - s, 'sec')
		return ret
	return wrap

@mt
def slv(N, M, SX, SY):
	ans = [(SX, SY)]
	for j in range(1, M + 1):
		if j == SY:
			continue
		ans.append((SX, j))
	s = j
	for i in range(1, N + 1):
		if i == SX:
			continue
		for j in range(1, M + 1) if s == 1 else range(M, 0, -1):
			ans.append((i, j))
		s = j
	return ans

def main():
	(N, M, SX, SY) = read_int_n()
	for r in slv(N, M, SX, SY):
		print(*r)
main()


a = list(map(int, input().split()))
print(a[2], a[3])
flag = 0
for i in range(a[2], a[0] + 1):
	if flag == 0:
		for j in range(1, a[1] + 1):
			if i != a[2] or j != a[3]:
				print(i, j)
		flag = 1
	else:
		for l in range(a[1], 0, -1):
			print(i, l)
		flag = 0
for k in range(1, a[2]):
	if flag == 0:
		for j in range(1, a[1] + 1):
			if i != a[2] or j != a[3]:
				print(k, j)
		flag = 1
	else:
		for l in range(a[1], 0, -1):
			print(k, l)
		flag = 0


(n, m, Sx, Sy) = list(map(int, input().split()))
print(Sx, Sy)
print(1, Sy)
for i in range(1, n + 1):
	if i % 2 == 1:
		for j in range(1, m + 1):
			if i == 1 and j == Sy or (i == Sx and j == Sy):
				pass
			else:
				print(i, j)
	else:
		for j in range(m, 0, -1):
			if i == Sx and j == Sy:
				pass
			else:
				print(i, j)


(n, m, sx, sy) = map(int, input().split())
print(sx, sy)
print(1, sy)
for i in range(1, n + 1, 2):
	for j in range(1, m + 1):
		if j == sy and (i == 1 or i == sx):
			pass
		else:
			print(i, j)
	if i < n:
		for j in range(m, 0, -1):
			if j == sy and (i + 1 == 1 or i + 1 == sx):
				pass
			else:
				print(i + 1, j)


(n, m, x, y) = map(int, input().split())
mat = []
for i in range(n):
	mat.append([0] * m)
cnt = m * (x - 1) + y
i = x
j = y
inc = 0
done = 0
while cnt != 0:
	if mat[i - 1][j - 1] == 0:
		print(i, j)
		mat[i - 1][j - 1] = 1
	if done == 0 and j == 2:
		done = 1
		print(i - 1, j)
		mat[i - 1 - 1][j - 1] = 1
		print(i - 1, j - 1)
		mat[i - 1 - 1][j - 1 - 1] = 1
		inc = 1
		j = 1
		i = i - 1
		cnt = cnt - 2
	if inc == 0:
		if j != 1:
			j = j - 1
		else:
			i = i - 1
			inc = 1
	elif j != m:
		j = j + 1
	else:
		i = i - 1
		inc = 0
	cnt = cnt - 1
cnt = m * (n - x + 1)
i = n
if j == 1:
	inc = 1
else:
	inc = 0
while cnt != 0:
	if mat[i - 1][j - 1] == 0:
		print(i, j)
	mat[i - 1][j - 1] = 1
	if inc == 0:
		if j != 1:
			j = j - 1
		else:
			i = i - 1
			inc = 1
	elif j != m:
		j = j + 1
	else:
		i = i - 1
		inc = 0
	cnt = cnt - 1


def main():

	def printrow(n, m, row, d):
		if d == 1:
			for i in range(1, m + 1):
				print(row, i)
		elif d == -1:
			for i in range(m, 0, -1):
				print(row, i)
	(n, m, x, y) = map(int, input().split())
	if y == 1:
		for j in range(1, m + 1):
			print(x, j)
		d = -1
		for i in range(1, n + 1):
			if i != x:
				printrow(n, m, i, d)
				d = -1 * d
	elif y == m:
		for j in range(m, 0, -1):
			print(x, j)
		d = 1
		for i in range(1, n + 1):
			if i != x:
				printrow(n, m, i, d)
				d = -1 * d
	else:
		for j in range(y, 0, -1):
			print(x, j)
		for j in range(y + 1, m + 1):
			print(x, j)
		d = -1
		for i in range(1, n + 1):
			if i != x:
				printrow(n, m, i, d)
				d = -1 * d
main()


import math
(n, m, x, y) = map(int, input().split())
a = [i + 1 for i in range(0, n)]
for l in range(0, n):
	b = [ii + 1 for ii in range(0, m)]
	e = a.pop(max(-1, x - 1))
	x = x - 1
	for k in range(0, m):
		f = b.pop(max(y - 1, -1))
		y = y - 1
		print(e, f)
		if k == m - 1:
			y = f


(n, m, x, y) = map(int, input().split())
a = [x, y]
b = [1, y]
print(*a)
print(*b)
for i in range(1, n + 1):
	if i % 2 != 0:
		for j in range(1, m + 1):
			if [i, j] not in [a, b]:
				print(i, j)
	else:
		for j in range(m, 0, -1):
			if [i, j] not in [a, b]:
				print(i, j)


read = input
rn = lambda : list(map(int, read().split()))
(n, m, sx, sy) = rn()

def on_row(sx, sy):
	for i in range(sy, sy + m):
		if i > m:
			i -= m
		print(sx, i)
on_row(sx, sy)
next_sy = sy
for i in range(1, n + 1):
	if i == sx:
		continue
	next_sx = i
	next_sy = next_sy - 1
	if next_sy == 0:
		next_sy = m
	on_row(next_sx, next_sy)


import sys, threading, os.path
import string
sys.setrecursionlimit(10 ** 6)
threading.stack_size(2 ** 27)

def go_up(n, m, x, y, results, X, Y):
	while x < n:
		x += 1
		if x == X and y <= Y:
			continue
		results.append((x, y))

def go_right(n, m, x, y, results):
	if y < m:
		y += 1
		results.append((x, y))

def go_down(n, m, x, y, results, X, Y):
	while x > 1:
		x -= 1
		if x == X and y <= Y:
			continue
		results.append((x, y))

def go_left(n, m, x, y, results):
	while y > 1:
		y -= 1
		results.append((x, y))

def main():
	if os.path.exists('in.rtf'):
		input = open('in.rtf', 'r')
	else:
		input = sys.stdin
	(n, m, x, y) = list(map(int, input.readline().split()))
	results = [(x, y)]
	go_left(n, m, x, y, results)
	for i in range(1, m + 1):
		(x1, y1) = (results[len(results) - 1][0], results[len(results) - 1][1])
		if i % 2 == 0:
			go_down(n, m, x1, y1, results, x, y)
			go_up(n, m, x1, y1, results, x, y)
		else:
			go_up(n, m, x1, y1, results, x, y)
			go_down(n, m, x1, y1, results, x, y)
		go_right(n, m, results[len(results) - 1][0], results[len(results) - 1][1], results)
	output = '\n'.join((str(e[0]) + ' ' + str(e[1]) for e in results))
	if os.path.exists('out.rtf'):
		open('out.rtf', 'w').writelines(str(output))
	else:
		sys.stdout.write(str(output))
main()


import sys

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math
from collections import defaultdict
(n, m, x, y) = ria()
print(x, y)
for i in range(1, n + 1):
	if i != x:
		print(i, y)
	end = 1
for j in range(y + 1, m + 1):
	x = []
	for i in range(n, 0, -1):
		if end % 2:
			print(i, j)
		else:
			x.append([i, j])
	if x != []:
		for i in x[::-1]:
			print(i[0], i[1])
	end += 1
for j in range(1, y):
	x = []
	for i in range(1, n + 1):
		if end % 2 == 0:
			print(i, j)
		else:
			x.append([i, j])
	if x != []:
		for i in x[::-1]:
			print(i[0], i[1])
	end += 1


(n, m, x, y) = map(int, input().split())
print(x, y)
print(1, y)
ans = ''
for i in range(1, n + 1, 2):
	for j in range(1, m + 1):
		if j == y and i in [1, x]:
			continue
		ans += f'{i} {j}\n'
	for j in range(m, 0, -1):
		if i == n:
			break
		if j == y and i + 1 in [1, x]:
			continue
		ans += f'{i + 1} {j}\n'
print(ans)


(n, m, y, x) = map(int, input().strip().split(' '))
curry = y
currx = x
tr = 0
while tr < n * m:
	for currx in range(x, m + 1):
		t = curry
		for y in range(t, 0, -1):
			print(y, currx)
			curry = y
			tr += 1
		for y in range(t + 1, n + 1):
			print(y, currx)
			curry = y
			tr += 1
	for currx in range(x - 1, 0, -1):
		t = curry
		for y in range(t, 0, -1):
			print(y, currx)
			curry = y
			tr += 1
		for y in range(t + 1, n + 1):
			print(y, currx)
			curry = y
			tr += 1


from collections import defaultdict
import copy

def ii():
	return int(input())

def si():
	return input()

def li():
	return list(map(int, input().split()))

def mi():
	return map(int, input().split())
arr = li()
m = arr[0]
n = arr[1]
sx = arr[2]
sy = arr[3]
for i in range(sx, m + 1):
	for j in range(sy, n + 1):
		print(i, j)
	for j in range(sy - 1, 0, -1):
		print(i, j)
	sy = j
for i in range(sx - 1, 0, -1):
	for j in range(sy, n + 1):
		print(i, j)
	for j in range(sy - 1, 0, -1):
		print(i, j)
	sy = j


(n, m, x, y) = [int(b) for b in input().split()]
count = 1
for _ in range(n * m):
	print((x - 1) % n + 1, (y - 1) % m + 1)
	if count < n:
		x += 1
		count += 1
	else:
		y += 1
		count = 1


(rows, cols, sx, sy) = list(map(int, input().split()))
vis = [[False for x in range(cols + 1)] for y in range(rows + 1)]
count = 1

def dfs(vis, x, y):
	print(x, y)
	flag = True
	vis[x][y] = True
	for a in range(2, cols + 1):
		if vis[x][a] == False:
			print(x, a)
			vis[x][a] = True
	print(x, 1)
	for a in range(1, rows + 1):
		if a == x:
			pass
		else:
			if flag:
				for b in range(1, cols + 1):
					if vis[a][b] == False:
						print(a, b)
						vis[a][b] = True
			else:
				for b in reversed(range(1, cols + 1)):
					if vis[a][b] == False:
						print(a, b)
						vis[a][b] = True
			flag = not flag
dfs(vis, sx, sy)


import math
import os
import random
import re
import sys
from collections import defaultdict, Counter, deque
import heapq
from functools import lru_cache
from itertools import accumulate, chain, combinations, permutations, groupby, zip_longest
from math import floor, ceil, sqrt

def coverRow(i, j, n):
	res = [(i, j)]
	for J in range(1, n + 1):
		if J == j:
			continue
		res += ((i, J),)
	return (res[-1][1], res)

def solve(m, n, i, j):
	res = []
	(end, coords) = coverRow(i, j, n)
	res += coords
	for I in range(1, m + 1):
		if I == i:
			continue
		(end, coords) = coverRow(I, end, n)
		res += coords
	return res
(m, n, i, j) = list(map(int, input().split()))
result = solve(m, n, i, j)
for ij in result:
	print(' '.join(map(str, ij)))


(n, m, x, y) = map(int, input().split())
s = y
for i in range(-1, n - 1):
	for j in range(-1, m - 1):
		print((i + x) % n + 1, (j + s) % m + 1)
	s = (j + s) % m + 1


def sol(n, m, x, y):
	for i in range(y, 0, -1):
		print(x, i)
	for i in range(y + 1, m + 1):
		print(x, i)
	flag = 1
	for i in range(1, n + 1):
		if i != x:
			if flag % 2:
				for j in range(m, 0, -1):
					print(i, j)
				flag += 1
			else:
				for j in range(1, m + 1):
					print(i, j)
				flag += 1
(n, m, x, y) = list(map(int, input().split(' ')))
sol(n, m, x, y)


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

def prt(a, b):
	print(str(a) + ' ' + str(b))
cl = [(1, sy), (sx, sy)]
prt(sx, sy)
prt(1, sy)
for i in range(1, n + 1):
	if i % 2 == 1:
		for j in range(1, m + 1):
			if not (i, j) in cl:
				prt(i, j)
	else:
		for j in range(m, 0, -1):
			if not (i, j) in cl:
				prt(i, j)


inu = input().split()
inu = [int(i) for i in inu]
(w, h, x, y) = inu
x = x - 1
y = y - 1
ay = y

def col(x, y):
	global ay
	ay = 0
	print(x + 1, y + 1)
	pos = [x, 0]
	for i in range(h):
		pos[1] = i
		if y != i:
			print(pos[0] + 1, pos[1] + 1)
			ay = pos[1]
col(x, y)
for i in range(w):
	if i != x:
		col(i, ay)


(n, m, Sx, Sy) = [int(x) for x in input().split()]
flag = True
for i in range(Sx, n + 1):
	print(f'{i} {Sy}')
for i in range(Sx - 1, 0, -1):
	print(f'{i} {Sy}')
for row in range(1, m + 1):
	if row == Sy:
		continue
	line = range(1, n + 1) if flag else range(n, 0, -1)
	for i in line:
		print(f'{i} {row}')
	flag ^= True


import math
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
import sys
mod = 10 ** 9 + 7
mod1 = 998244353
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192
sys.setrecursionlimit(300000)

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class TreeNode:

	def __init__(self, k, v):
		self.key = k
		self.value = v
		self.left = None
		self.right = None
		self.parent = None
		self.height = 1
		self.num_left = 1
		self.num_total = 1

class AvlTree:

	def __init__(self):
		self._tree = None

	def add(self, k, v):
		if not self._tree:
			self._tree = TreeNode(k, v)
			return
		node = self._add(k, v)
		if node:
			self._rebalance(node)

	def _add(self, k, v):
		node = self._tree
		while node:
			if k < node.key:
				if node.left:
					node = node.left
				else:
					node.left = TreeNode(k, v)
					node.left.parent = node
					return node.left
			elif node.key < k:
				if node.right:
					node = node.right
				else:
					node.right = TreeNode(k, v)
					node.right.parent = node
					return node.right
			else:
				node.value = v
				return

	@staticmethod
	def get_height(x):
		return x.height if x else 0

	@staticmethod
	def get_num_total(x):
		return x.num_total if x else 0

	def _rebalance(self, node):
		n = node
		while n:
			lh = self.get_height(n.left)
			rh = self.get_height(n.right)
			n.height = max(lh, rh) + 1
			balance_factor = lh - rh
			n.num_total = 1 + self.get_num_total(n.left) + self.get_num_total(n.right)
			n.num_left = 1 + self.get_num_total(n.left)
			if balance_factor > 1:
				if self.get_height(n.left.left) < self.get_height(n.left.right):
					self._rotate_left(n.left)
				self._rotate_right(n)
			elif balance_factor < -1:
				if self.get_height(n.right.right) < self.get_height(n.right.left):
					self._rotate_right(n.right)
				self._rotate_left(n)
			else:
				n = n.parent

	def _remove_one(self, node):
		replacement = node.left or node.right
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = replacement
			else:
				node.parent.right = replacement
			replacement.parent = node.parent
			node.parent = None
		else:
			self._tree = replacement
			replacement.parent = None
		node.left = None
		node.right = None
		node.parent = None
		self._rebalance(replacement)

	def _remove_leaf(self, node):
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = None
			else:
				node.parent.right = None
			self._rebalance(node.parent)
		else:
			self._tree = None
		node.parent = None
		node.left = None
		node.right = None

	def remove(self, k):
		node = self._get_node(k)
		if not node:
			return
		if AvlTree._is_leaf(node):
			self._remove_leaf(node)
			return
		if node.left and node.right:
			nxt = AvlTree._get_next(node)
			node.key = nxt.key
			node.value = nxt.value
			if self._is_leaf(nxt):
				self._remove_leaf(nxt)
			else:
				self._remove_one(nxt)
			self._rebalance(node)
		else:
			self._remove_one(node)

	def get(self, k):
		node = self._get_node(k)
		return node.value if node else -1

	def _get_node(self, k):
		if not self._tree:
			return None
		node = self._tree
		while node:
			if k < node.key:
				node = node.left
			elif node.key < k:
				node = node.right
			else:
				return node
		return None

	def get_at(self, pos):
		x = pos + 1
		node = self._tree
		while node:
			if x < node.num_left:
				node = node.left
			elif node.num_left < x:
				x -= node.num_left
				node = node.right
			else:
				return (node.key, node.value)
		raise IndexError('Out of ranges')

	@staticmethod
	def _is_left(node):
		return node.parent.left and node.parent.left == node

	@staticmethod
	def _is_leaf(node):
		return node.left is None and node.right is None

	def _rotate_right(self, node):
		if not node.parent:
			self._tree = node.left
			node.left.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.left
			node.left.parent = node.parent
		else:
			node.parent.right = node.left
			node.left.parent = node.parent
		bk = node.left.right
		node.left.right = node
		node.parent = node.left
		node.left = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	def _rotate_left(self, node):
		if not node.parent:
			self._tree = node.right
			node.right.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.right
			node.right.parent = node.parent
		else:
			node.parent.right = node.right
			node.right.parent = node.parent
		bk = node.right.left
		node.right.left = node
		node.parent = node.right
		node.right = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	@staticmethod
	def _get_next(node):
		if not node.right:
			return node.parent
		n = node.right
		while n.left:
			n = n.left
		return n

class SegmentTree1:

	def __init__(self, data, default=0, func=lambda a, b: max(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: a + b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD

def powm(a, n, m):
	if a == 1 or n == 0:
		return 1
	if n % 2 == 0:
		s = powm(a, n // 2, m)
		return s * s % m
	else:
		return a * powm(a, n - 1, m) % m

def sort_list(list1, list2):
	zipped_pairs = zip(list2, list1)
	z = [x for (_, x) in sorted(zipped_pairs)]
	return z

def product(l):
	por = 1
	for i in range(len(l)):
		por *= l[i]
	return por

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] < key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def countdig(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def binary(x, length):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y

def countGreater(arr, n, k):
	l = 0
	r = n - 1
	leftGreater = n
	while l <= r:
		m = int(l + (r - l) / 2)
		if arr[m] >= k:
			leftGreater = m
			r = m - 1
		else:
			l = m + 1
	return n - leftGreater
for ik in range(1):
	(n, m, c, d) = map(int, input().split())
	t = 0
	cop = c
	while c != 0:
		if t == 0:
			for i in range(d, 0, -1):
				print(c, i)
		else:
			for i in range(1, d + 1):
				print(c, i)
		c -= 1
		t += 1
		t %= 2
	t = 0
	c += 1
	while c != n + 1:
		if t == 0:
			for i in range(d + 1, m + 1):
				print(c, i)
		else:
			for i in range(m, d, -1):
				print(c, i)
		c += 1
		t += 1
		t %= 2
	t = 0
	c = n
	while c != cop:
		if t == 0:
			for i in range(d, 0, -1):
				print(c, i)
		else:
			for i in range(1, d + 1):
				print(c, i)
		c -= 1
		t += 1
		t %= 2


import math
from collections import Counter, defaultdict
from sys import stdin, stdout
input = stdin.readline
I = lambda : int(input())
M = lambda : map(int, input().split())
LI = lambda : list(map(int, input().split()))
(a, b, c, d) = M()
print(c, d)
for i in range(c - 1, 0, -1):
	print(i, d)
for i in range(c + 1, a + 1):
	print(i, d)
c = 0
for i in range(d - 1, 0, -1):
	if c % 2 == 0:
		for j in range(a, 0, -1):
			print(j, i)
	else:
		for j in range(1, a + 1):
			print(j, i)
	c += 1
c %= 2
e = 0
if c == 0:
	for i in range(d + 1, b + 1):
		if e % 2 == 0:
			for j in range(a, 0, -1):
				print(j, i)
		else:
			for j in range(1, a + 1):
				print(j, i)
		e += 1
else:
	for i in range(d + 1, b + 1):
		if e % 2 == 0:
			for j in range(1, a + 1):
				print(j, i)
		else:
			for j in range(a, 0, -1):
				print(j, i)
		e += 1


inp = input().split()
n = int(inp[0])
m = int(inp[1])
x = int(inp[2])
y = int(inp[3])
board = [[0] * m for i in range(n)]
board[x - 1][y - 1] = 1
board[x - 1][0] = 1
result = [(x, y), (x, 0 + 1)]
current_stolb = 0
current_strok = x - 1
for strok in range(n):
	for stolb in range(m):
		if board[current_strok][stolb] != 1:
			result.append((current_strok + 1, stolb + 1))
			current_stolb = stolb
			board[current_strok][stolb] = 1
	current_strok = strok
	if board[current_strok][current_stolb] != 1:
		result.append((current_strok + 1, current_stolb + 1))
	board[current_strok][current_stolb] = 1
for stolb in range(m):
	if board[current_strok][stolb] != 1:
		result.append((current_strok + 1, stolb + 1))
		board[current_strok][stolb] = 1
for res in result:
	print(f'{res[0]} {res[1]}')


import sys
input = lambda : sys.stdin.readline().strip()
char = [chr(i) for i in range(97, 123)]
CHAR = [chr(i) for i in range(65, 91)]
mp = lambda : list(map(int, input().split()))
INT = lambda : int(input())
rn = lambda : range(INT())
from math import ceil, sqrt, factorial, gcd
(n, m, x, y) = mp()
l = []
if x != 1 and y != 1:
	l.append((x, y))
	l.append((1, y))
elif x != 1:
	l.append((x, y))
elif y != 1:
	l.append((x, y))
d = set(l)
for i in range(1, n + 1):
	for j in range(1, m + 1):
		if i % 2 == 1:
			h = (i, j)
			if h not in d:
				l.append(h)
				d.add(h)
		else:
			h = (i, m + 1 - j)
			if h not in d:
				l.append(h)
				d.add(h)
for k in l:
	print(*k)


from sys import stdin, stdout
import bisect
import math
from collections import deque
mod = 10 ** 9 + 7

def st():
	return list(stdin.readline().strip())

def inp():
	return int(stdin.readline())

def li():
	return list(map(int, stdin.readline().split()))

def mp():
	return map(int, stdin.readline().split())

def pr(n):
	stdout.write(str(n) + '\n')

def DFS(dictionary, vertex, visited):
	visited[vertex] = True
	stack = [vertex]
	print(vertex)
	while stack:
		a = stack.pop()
		for i in dictionary[a]:
			if not visited[i]:
				print(i)
				visited[i] = True
				stack.append(i)

def BFS(dictionary, vertex, visited):
	visited[vertex] = True
	q = deque()
	q.append(vertex)
	while q:
		a = q.popleft()
		for i in dictionary[a]:
			if not visited[i]:
				visited[i] = True
				q.append(i)
				print(i)

def soe(limit):
	l = [1] * (limit + 1)
	l[0] = 0
	l[1] = 0
	prime = []
	for i in range(2, limit + 1):
		if l[i]:
			for j in range(i * i, limit + 1, i):
				l[j] = 0
	for i in range(2, limit + 1):
		if l[i]:
			prime.append(i)
	return prime

def segsoe(low, high):
	limit = int(high ** 0.5) + 1
	prime = soe(limit)
	n = high - low + 1
	l = [0] * (n + 1)
	for i in range(len(prime)):
		lowlimit = low // prime[i] * prime[i]
		if lowlimit < low:
			lowlimit += prime[i]
		if lowlimit == prime[i]:
			lowlimit += prime[i]
		for j in range(lowlimit, high + 1, prime[i]):
			l[j - low] = 1
	for i in range(low, high + 1):
		if not l[i - low]:
			if i != 1:
				print(i)

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

def power(a, n):
	r = 1
	while n:
		if n & 1:
			r = r * a
		a *= a
		n = n >> 1
	return r

def solve():
	(n, m, a, b) = mp()
	x = a
	y = b
	z = b
	while z <= m:
		print(x, z)
		z += 1
	z = b - 1
	while z >= 1:
		print(x, z)
		z -= 1
	z = b
	c = 1
	for i in range(1, m + 1):
		if c:
			j = x + 1
			while j <= n:
				print(j, i)
				j += 1
			c = 0
		else:
			j = n
			while j > a:
				print(j, i)
				j -= 1
			c = 1
	c = 1
	for i in range(m, 0, -1):
		if c:
			j = x - 1
			while j >= 1:
				print(j, i)
				j -= 1
			c = 0
		else:
			j = 1
			while j < x:
				print(j, i)
				j += 1
			c = 1
for _ in range(1):
	solve()


(n, m, sx, sy) = [int(x) for x in input().split(' ')]
print(sx, sy)
print(1, sy)
print(1, 1)
j = 1
while j <= n:
	if j % 2:
		for i in range(1, m + 1):
			if i == 1 and j == 1 or (i == sy and j == sx) or (i == sy and j == 1):
				continue
			print(j, i)
	else:
		for i in range(m, 0, -1):
			if i == 1 and j == 1 or (i == sy and j == sx) or (i == sy and j == 1):
				continue
			print(j, i)
	j += 1


data = list(map(int, input().strip().split()))
n = data[0]
m = data[1]
s_x = data[2]
s_y = data[3]
row_list = [x for x in range(1, n + 1)]
first_column = s_y
for i in range(1, n + 1):
	print(s_x, end=' ')
	print(first_column)
	for j in range(1, m + 1):
		if j != first_column:
			print(s_x, end=' ')
			print(j)
			last_column = j
	first_column = last_column
	if i != n:
		row_list.remove(s_x)
		s_x = row_list[0]


(r, c, x, y) = map(int, input().split())
print('%d %d' % (x, y))
print('%d %d' % (1, y))
for i in range(1, r + 1):
	if i % 2 == 1:
		for j in range(1, c + 1):
			if i == x and j == y or (i == 1 and j == y):
				pass
			else:
				print(i, j)
	else:
		for j in range(c, 0, -1):
			if i == x and j == y or (i == 1 and j == y):
				pass
			else:
				print(i, j)


(n, m, x, y) = map(int, input().split())
ans = [(x, y)]
for j in range(y + 1, m + 1):
	ans.append((x, j))
for j in range(y - 1, 0, -1):
	ans.append((x, j))
flg = True
for i in range(1, n + 1):
	if i != x:
		if flg:
			for j in range(1, m + 1):
				ans.append((i, j))
			flg ^= True
		else:
			for j in range(m, 0, -1):
				ans.append((i, j))
			flg ^= True
for i in ans:
	print(*i)


(n, m, x, y) = map(int, input().split())
print(x, y)
print(1, y)
print(1, 1)
flag = 0
for i in range(n):
	if flag == 0:
		for j in range(m):
			if i == 0:
				if j == y - 1 or j == 0:
					continue
				else:
					print(i + 1, j + 1)
			elif i == x - 1 and j == y - 1:
				continue
			else:
				print(i + 1, j + 1)
		flag = 1
	else:
		for j in reversed(range(m)):
			if i == 0:
				if j == y - 1 or j == 0:
					continue
				else:
					print(i + 1, j + 1)
			elif i == x - 1 and j == y - 1:
				continue
			else:
				print(i + 1, j + 1)
		flag = 0


(n, m, sx, sy) = map(int, input().split())
for y in range(sy, m + 1):
	print(sx, y)
for y in range(sy - 1, 0, -1):
	print(sx, y)
to_back = True
for x in range(1, n + 1):
	if x == sx:
		continue
	if to_back:
		for y in range(1, m + 1):
			print(x, y)
	else:
		for y in range(m, 0, -1):
			print(x, y)
	to_back = not to_back


(a, b, c, d) = map(int, input().split())
for i in range(a):
	for j in range(b):
		x = (c + i) % a if (c + i) % a else a
		y = (d + j) % b if (d + j) % b else b
		print(x, y)
	d -= 1


(n, m, x, y) = [int(z) for z in input().split()]
for i in range(n):
	for j in range(m):
		print(x, y)
		if y == m:
			y = 1
		else:
			y += 1
	if y == 1:
		y = m
	else:
		y -= 1
	if x == n:
		x = 1
	else:
		x += 1


(n, m, Sx, Sy) = map(int, input().split())
print(Sx, Sy)
for i in range(1, n + 1):
	if i == Sx:
		continue
	print(i, Sy)
	x = i
Sx = x
for i in range(1, m + 1):
	if i == Sy:
		continue
	print(Sx, i)
	for j in range(1, n + 1):
		if j == Sx:
			continue
		print(j, i)
		x = j
	Sx = x


(n, m, sx, sy) = list(map(int, input().split()))
ans = [[sx, sy]]
x = sx
y = sy
d = 0
e = 0
for i in range(m):
	c = 0
	for j in range(n - 1):
		if sx <= n - 1 and c == 0:
			sx += 1
			ans.append([sx, sy])
			if sx == n and e == 0:
				sx = x
				c = 1
				e = 1
		else:
			sx -= 1
			ans.append([sx, sy])
			c = 1
		if sy == m and j == n - 2:
			sy = y
			d = 1
	if i == m - 1:
		break
	if sy <= m - 1 and d == 0:
		sy += 1
		ans.append([sx, sy])
	else:
		sy -= 1
		d = 1
		ans.append([sx, sy])
for i in ans:
	a = ''
	for j in i:
		a += str(j)
		a += ' '
	print(a)


(n, m, sx, sy) = map(int, input().split())
ans = [(sx, sy)]
ans.append((1, sy))
for i in range(n):
	for j in range(m):
		if i % 2 == 1:
			j1 = j
		else:
			j1 = m - 1 - j
		if (i + 1, j1 + 1) != (sx, sy) and (i + 1, j1 + 1) != (1, sy):
			ans.append((i + 1, j1 + 1))
for (a, b) in ans:
	print(a, b)


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
ORDA = 97

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return [int(i) for i in input().split()]

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=2):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	new_number = 0
	while number > 0:
		new_number += number % base
		number //= base
	return new_number

def cdiv(n, k):
	return n // k + (n % k != 0)

def ispal(s):
	for i in range(len(s) // 2 + 1):
		if s[i] != s[-i - 1]:
			return False
	return True
(n, m, sx, sy) = mi()
ans = [[sx, sy], [1, sy]]
for i in range(1, m + 1):
	if i != sy:
		ans.append([1, i])
for i in range(2, n + 1):
	if i & 1:
		for j in range(1, m + 1):
			if [i, j] == [sx, sy]:
				continue
			else:
				ans.append([i, j])
	else:
		for j in range(m, 0, -1):
			if [i, j] == [sx, sy]:
				continue
			else:
				ans.append([i, j])
for i in ans:
	print(*i)


import math
from decimal import *
import random
(n, m, y, x) = map(int, input().split())
grid = [[0 for i in range(m)] for i in range(n)]
ans = [[str(y), str(x)]]
grid[y - 1][x - 1] = 1
(posx, posy) = (x - 1, y - 1)
for i in range(y - 1):
	posy -= 1
	if grid[posy][posx] == 0:
		grid[posy][posx] = 1
		ans.append([str(posy + 1), str(posx + 1)])
cnt = 0
for i in range(n):
	if cnt % 2 == 0:
		for j in range(m):
			if grid[i][j] == 0:
				ans.append([str(i + 1), str(j + 1)])
				grid[i][j] = 1
	else:
		for j in range(m - 1, -1, -1):
			if grid[i][j] == 0:
				ans.append([str(i + 1), str(j + 1)])
				grid[i][j] = 1
	cnt += 1
for i in ans:
	print(i[0], i[1])


from collections import defaultdict as dd
import math
import sys
input = sys.stdin.readline

def nn():
	return int(input())

def li():
	return list(input())

def mi():
	return map(int, input().split())

def lm():
	return list(map(int, input().split()))

def solve():
	(n, m, x, y) = mi()
	print(x, y)
	for i in range(1, m + 1):
		if not i == y:
			print(x, i)
	par = 1
	for j in range(1, n + 1):
		if not j == x:
			if par == 0:
				for i in range(1, m + 1):
					print(j, i)
			if par == 1:
				for i in reversed(range(1, m + 1)):
					print(j, i)
			par = (par + 1) % 2
	return
q = 1
for _ in range(q):
	solve()


(r, g, x, y) = map(int, input().split())
x = x - 1
y = y - 1
wi = 0
for i in range(r):
	wi = -i
	if wi + y < 0:
		wi = wi + g
	for w in range(g):
		print((i + x) % r + 1, (y + wi) % g + 1)
		wi = wi + 1


(n, m, xi, yi) = [int(j) for j in input().split()]
l = [xi]
nl = [yi]
for i in range(n):
	if i + 1 != xi:
		l.append(i + 1)
for i in range(m):
	if i + 1 != yi:
		nl.append(i + 1)
for xi in l:
	for yi in nl:
		print(xi, yi)
	nl.reverse()


(n, m, x, y) = map(int, input().split())
(a, b) = (x, y)
while y < m + 1:
	while x > 0:
		print(x, y)
		x -= 1
	y += 1
	x = 1
	while y <= m and x <= a:
		print(x, y)
		x += 1
	y += 1
	x = a
(x, y) = (a + 1, m)
while y > 0:
	while x <= n:
		print(x, y)
		x += 1
	y -= 1
	x = n
	while y > 0 and x > a:
		print(x, y)
		x -= 1
	y -= 1
	x = a + 1
(x, y) = (a, 1)
while y < b:
	while x > 0:
		print(x, y)
		x -= 1
	y += 1
	x = 1
	while y < b and x <= a:
		print(x, y)
		x += 1
	y += 1
	x = a


(n, m, sx, sy) = map(int, input().split())
for i in range(n):
	for j in range(i * m - i, i * m - i + m):
		print((sx + i - 1) % n + 1, (sy + j - 1) % m + 1)


import io
import os
from collections import Counter, defaultdict, deque

def solveIntended(R, C, r0, c0):
	ans = []
	c = c0
	rs = list(range(R))
	rs.remove(r0)
	rs = [r0] + rs
	for r in rs:
		for i in range(C):
			ans.append(str(r + 1) + ' ' + str(c + 1))
			if i != C - 1:
				c = (c + 1) % C
	return '\n'.join(ans)

def solve(R, C, r0, c0):
	if R % 2 == 1 and C % 2 == 1:
		return solveIntended(R, C, r0, c0)

	def weave(minR, maxR, minC, maxC, r, c, direction):
		assert r in [minR, maxR]
		assert c in [minC, maxC]
		rows = list(range(minR, maxR + 1))
		cols = list(range(minC, maxC + 1))
		if r == maxR:
			rows = rows[::-1]
		if c == maxC:
			cols = cols[::-1]
		if direction == 'h':
			for r in rows:
				for c in cols:
					yield (r, c)
				cols = cols[::-1]
		else:
			assert direction == 'v'
			for c in cols:
				for r in rows:
					yield (r, c)
				rows = rows[::-1]

	def hamCycle(minR, maxR, minC, maxC):
		numRows = maxR - minR + 1
		numCols = maxC - minC + 1
		assert numRows >= 2 and numCols >= 2
		assert numRows % 2 == 0 or numCols % 2 == 0
		cycle = deque()
		if numRows % 2 == 0:
			(r, c) = (minR, minC)
			for r in range(minR, maxR + 1):
				cycle.appendleft((r, c))
			assert (r, c) == (maxR, minC)
			c += 1
			assert (r, c) == (maxR, minC + 1)
			for (r, c) in weave(minR, maxR, minC + 1, maxC, r, c, 'h'):
				cycle.appendleft((r, c))
			assert (r, c) == (minR, minC + 1)
		elif numCols % 2 == 0:
			(r, c) = (minR, minC)
			for c in range(minC, maxC + 1):
				cycle.append((r, c))
			assert (r, c) == (minR, maxC)
			r += 1
			assert (r, c) == (minR + 1, maxC)
			for (r, c) in weave(minR + 1, maxR, minC, maxC, r, c, 'v'):
				cycle.append((r, c))
			assert (r, c) == (minR + 1, minC)
		else:
			assert False
		return cycle

	def reindex(cycle, r, c):
		index = cycle.index((r, c))
		cycle.rotate(-index)
		assert cycle[0] == (r, c)
	if R % 2 == 0 or C % 2 == 0:
		ans = hamCycle(0, R - 1, 0, C - 1)
		reindex(ans, r0, c0)
	else:
		assert (r0 + c0) % 2 == 0
		assert False
	return '\n'.join((str(r + 1) + ' ' + str(c + 1) for (r, c) in ans))
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
(N, M, X, Y) = [int(x) for x in input().split()]
X -= 1
Y -= 1
ans = solve(N, M, X, Y)
print(ans)


def ans(a):
	n = a[0]
	m = a[1]
	x = a[2]
	y = a[3]
	counter = 0
	for i in range(x, x + n):
		row = i % n
		if row == 0:
			row = n
		counter += 1
		start = y - counter + 1
		loop = 0
		while loop < m:
			column = (start + loop) % m
			if column == 0:
				column = m
			print(str(row) + ' ' + str(column))
			loop += 1
a = input().split()
arr = []
for i in a:
	arr.append(int(i))
ans(arr)


(n, m, x, y) = map(int, input().split())
for i in range(n):
	for j in range(m):
		xpos = (x + i) % n
		ypos = (y + j) % m
		if xpos == 0:
			xpos = n
		if ypos == 0:
			ypos = m
		print(xpos, ypos)
	y -= 1


(n, m, sx, sy) = map(int, input().split())
sx -= 1
sy -= 1
ans = 'No'
for w in range(n):
	x = (w + sx) % n
	for h in range(m):
		y = (h + sy) % m
		print(x + 1, y + 1)
	sy = (m - 1 + sy) % m


(n, m, r, c) = map(int, input().split())
r -= 1
c -= 1
print(r + 1, c + 1)
for i in range(r + 1, n):
	print(i + 1, c + 1)
for i in range(r - 1, -1, -1):
	print(i + 1, c + 1)
for j in range(c + 1, m):
	print(1, j + 1)
for j in range(c - 1, -1, -1):
	print(1, j + 1)
turn = 2
row = 1
while row < n:
	if turn % 2 == 0:
		for j in range(c):
			print(row + 1, j + 1)
		for j in range(c + 1, m):
			print(row + 1, j + 1)
		turn += 1
		row += 1
	else:
		for j in range(m - 1, c, -1):
			print(row + 1, j + 1)
		for j in range(c - 1, -1, -1):
			print(row + 1, j + 1)
		turn += 1
		row += 1


(n, m, initx, init_y) = map(int, input().split(' '))
print(initx, init_y)
print(1, init_y)
j1 = list(range(1, m + 1))
j2 = list(range(1, m + 1))
j2.reverse()
for i in range(1, n + 1):
	if i % 2 == 1:
		for j in j1:
			if i == initx and j == init_y or (i == 1 and j == init_y):
				continue
			else:
				print(i, j)
	else:
		for j in j2:
			if i == initx and j == init_y or (i == 1 and j == init_y):
				continue
			else:
				print(i, j)


(n, m, p, q) = [int(x) for x in input().split()]
row = {}
for i in range(1, n + 1):
	row[i] = 0
for i in range(q, m + 1):
	print(p, i)
for i in range(q - 1, 0, -1):
	print(p, i)
prev = 'bk'
for i in range(p + 1, n + 1):
	if prev == 'bk':
		for j in range(1, m + 1):
			print(i, j)
		prev = 'fr'
	else:
		for j in range(m, 0, -1):
			print(i, j)
		prev = 'bk'
for i in range(p - 1, 0, -1):
	if prev == 'bk':
		for j in range(1, m + 1):
			print(i, j)
		prev = 'fr'
	else:
		for j in range(m, 0, -1):
			print(i, j)
		prev = 'bk'


(n, m, x, y) = map(int, input().split())
c = n
d = m
k = n * m
st_x = x
st_y = y
visited = y
print(x, y)
while c > 0:
	c -= 1
	for i in range(1, m + 1):
		if i == visited:
			pass
		else:
			print(x, i)
	if visited == m:
		visited = m - 1
	else:
		visited = m
	x += 1
	if x > n:
		x = 1
	if c > 0:
		print(x, visited)


def f(i, j):
	return [(i + sx - 2) % n + 1, (j + sy - 2) % m + 1]
(n, m, sx, sy) = map(int, input().split(' '))
for i in range(1, n + 1):
	if i % 2 == 0:
		for j in range(m, 0, -1):
			print(' '.join(map(str, f(i, j))))
	else:
		for j in range(1, m + 1):
			print(' '.join(map(str, f(i, j))))


(n, m, x, y) = map(int, input().split())
dp = []
for i in range(n):
	dp.append([])
x -= 1
y -= 1
temp = list(range(1, m - y + 1))
t2 = list(range(m - y + 1, m + 1))[::-1]
temp = t2 + temp
dp[x] = temp
flag = True
c = m + 1
for i in range(x + 1, n):
	if flag:
		dp[i] = list(range(c, c + m))
		c += m
		flag = False
	elif not flag:
		dp[i] = list(range(c, c + m))[::-1]
		c += m
		flag = True
for i in range(x - 1, -1, -1):
	if flag:
		dp[i] = list(range(c, c + m))
		c += m
		flag = False
	elif not flag:
		dp[i] = list(range(c, c + m))[::-1]
		c += m
		flag = True
ans = []
for i in range(n * m):
	ans.append([])
for i in range(n):
	for j in range(m):
		ans[dp[i][j] - 1] = [i + 1, j + 1]
for i in ans:
	print(*i)


import random

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

def lcm(a, b):
	return a * b / gcd(a, b)
(n, m, x, y) = map(int, input().split())
vis = [[0 for i in range(m)] for j in range(n)]
vis[x - 1][y - 1] = 1
vis[0][y - 1] = 1
vis[0][0] = 1
print(x, y)
print(1, y)
print(1, 1)
f = 0
for i in range(n):
	if f == 0:
		for j in range(m):
			if vis[i][j] == 0:
				vis[i][j] = 1
				print(i + 1, j + 1)
		f = 1
	else:
		for j in range(m - 1, -1, -1):
			if vis[i][j] == 0:
				vis[i][j] = 1
				print(i + 1, j + 1)
		f = 0


(n, m, x, y) = list(map(int, input().split()))
(initial_row, initial_col) = (x, y)
print(x, y)
side = 0
count = 1
while x <= n:
	if side == 0:
		for j in range(1, m + 1):
			if j != y or x != initial_row:
				print(x, j)
				count += 1
		x += 1
		side = 1
	else:
		for j in range(m, 0, -1):
			print(x, j)
			count += 1
		x += 1
		side = 0
if side == 0:
	(x, y) = (1, 1)
	while x < initial_row:
		if side == 0:
			for j in range(1, m + 1):
				print(x, j)
				count += 1
			x += 1
			side = 1
		else:
			for j in range(m, 0, -1):
				print(x, j)
				count += 1
			x += 1
			side = 0
else:
	(x, y) = (1, m)
	while x < initial_row:
		if side == 0:
			for j in range(1, m + 1):
				print(x, j)
				count += 1
			x += 1
			side = 1
		else:
			for j in range(m, 0, -1):
				print(x, j)
				count += 1
			x += 1
			side = 0


(n, m, sx, sy) = map(int, input().split())
hashset = set()
hashset.add((sx, sy))
print(sx, sy)
if (1, sy) not in hashset:
	hashset.add((1, sy))
	print(1, sy)
if (1, 1) not in hashset:
	hashset.add((1, 1))
	print(1, 1)
(x, y) = (1, 1)
while len(hashset) < n * m:
	for j in range(1, m + 1):
		if (x, j) not in hashset:
			hashset.add((x, j))
			print(x, j)
	x += 1
	if len(hashset) < n * m:
		for j in range(m, 0, -1):
			if (x, j) not in hashset:
				hashset.add((x, j))
				print(x, j)
		x += 1


def printing(x, y):
	print(x, end=' ')
	print(y)

def upperrows(n, m, x, y):
	for i in reversed(range(1, x)):
		if (x - i) % 2 == 1:
			for j in reversed(range(1, m + 1)):
				printing(i, j)
		else:
			for j in range(1, m + 1):
				printing(i, j)
	return j

def lowerrows(n, m, x, k):
	for i in reversed(range(x + 1, n + 1)):
		if k == m:
			for j in reversed(range(1, m + 1)):
				printing(i, j)
			k = 1
		else:
			for j in range(1, m + 1):
				printing(i, j)
			k = m

def samerow(n, m, x, y):
	for i in reversed(range(1, y)):
		printing(x, i)
	for i in range(y + 1, m + 1):
		printing(x, i)
(n, m, x, y) = list(map(int, input().split()))
printing(x, y)
samerow(n, m, x, y)
k = upperrows(n, m, x, m)
lowerrows(n, m, x, k)


(n, m, x, y) = map(int, input().split())
mat = [[False] * m for i in range(n)]
x -= 1
y -= 1
(i, j) = (x, y)
print(i + 1, j + 1)
mat[i][j] = True
print(1, j + 1)
mat[0][j] = True
front = True
(i, j) = (0, 0)
while i < n and j < m:
	if not mat[i][j]:
		print(i + 1, j + 1)
		mat[i][j] = True
	if j == m - 1 and front or (j == 0 and (not front)):
		i += 1
		front = not front
	elif front:
		j += 1
	else:
		j -= 1


arr = list(map(int, input().split()))
n = arr[0]
m = arr[1]
sx = arr[2]
sy = arr[3]
sol = []
sol.append([sx, sy])
sol.append([1, sy])
j = 1
for i in range(1, n + 1):
	if j == 1:
		ini = 1
		fin = m + 1
		inc = 1
	else:
		ini = m
		fin = 0
		inc = -1
	for j in range(ini, fin, inc):
		if j == sy and i == 1:
			continue
		if i == sx and j == sy:
			continue
		sol.append([i, j])
for i in sol:
	print(*i)


from sys import stdin
(n, m, x, y) = list(map(int, stdin.readline().strip().split()))
r = [y]
l = [x]
for i in range(1, m + 1):
	if i == y:
		continue
	r.append(i)
for i in range(1, n + 1):
	if i == x:
		continue
	l.append(i)
r1 = r.copy()
r1 = r1[::-1]
x = 0
for i in l:
	if x % 2 == 0:
		for j in r:
			print(i, j)
	else:
		for j in r1:
			print(i, j)
	x += 1


(n, m, X, Y) = map(int, input().split(' '))
for x in range(X, n + 1):
	print('{} {}'.format(x, Y))
	for y in range(Y + 1, m + 1):
		print('{} {}'.format(x, y))
	for y in range(1, Y):
		print('{} {}'.format(x, y))
	Y -= 1
	if Y == 0:
		Y = m
for x in range(1, X):
	print('{} {}'.format(x, Y))
	for y in range(Y + 1, m + 1):
		print('{} {}'.format(x, y))
	for y in range(1, Y):
		print('{} {}'.format(x, y))
	Y -= 1
	if Y == 0:
		Y = m


(n, m, x, y) = map(int, input().split())
res = [[x, y]]
for i in range(1, m + 1):
	if y != i:
		res.append([x, i])
left = 1
for i in range(x + 1, n + 1):
	if left:
		for j in range(m, 0, -1):
			res.append([i, j])
	else:
		for j in range(1, m + 1):
			res.append([i, j])
	left ^= 1
for i in range(1, x):
	if left:
		for j in range(m, 0, -1):
			res.append([i, j])
	else:
		for j in range(1, m + 1):
			res.append([i, j])
	left ^= 1
for i in res:
	print(*i)


(n, m, y, x) = map(int, input().split(' '))
y -= 1
x -= 1
for ri in range(n):
	for ci in range(m):
		print(y + 1, x + 1)
		x = (x + 1) % m
	x = (x - 1) % m
	y = (y + 1) % n


(n, m, x, y) = map(int, input().split())
print(x, y)
a = 0
for i in range(1, m + 1):
	if i == y:
		pass
	else:
		print(x, i)
for i in range(1, n + 1):
	if a % 2 == 0:
		for j in range(m, 0, -1):
			if i == x:
				pass
			else:
				print(i, j)
	else:
		for k in range(1, m + 1):
			if i == x:
				pass
			else:
				print(i, k)
	if i == x:
		a += 0
	else:
		a += 1


def main():
	(n, m, x, y) = map(int, input().split())
	d = {}
	k = str(x) + str(y)
	d[k] = 1
	print(x, y)
	print(1, y)
	t1 = 0
	t2 = y
	d[str(0) + str(y)] = 1
	i = 0
	while i < n:
		for j in range(m):
			if i + 1 == x and j + 1 == y:
				continue
			elif i + 1 == 1 and j + 1 == y:
				continue
			else:
				print(i + 1, j + 1)
		i += 1
		if i >= n:
			break
		for j in range(m, 0, -1):
			if i + 1 == x and j == y:
				continue
			elif i + 1 == 1 and j == y:
				continue
			else:
				print(i + 1, j)
		i += 1
main()


nums = input().split(' ')
nums = [int(x) for x in nums]
n = nums[0]
m = nums[1]
sx = nums[2]
sy = nums[3]
print(str(sx) + ' ' + str(sy))
for i in range(1, n + 1):
	if i != sx:
		print(str(i) + ' ' + str(sy))
for i in range(1, m + 1):
	if i < sy:
		if i % 2 == 1:
			for j in range(n, 0, -1):
				print(str(j) + ' ' + str(i))
		else:
			for j in range(1, n + 1):
				print(str(j) + ' ' + str(i))
	elif i > sy:
		if (i - 1) % 2 == 1:
			for j in range(n, 0, -1):
				print(str(j) + ' ' + str(i))
		else:
			for j in range(1, n + 1):
				print(str(j) + ' ' + str(i))


def gt():
	return list(map(int, input().split()))
(n, m, x, y) = gt()
vis = [[0 for j in range(m + 1)] for i in range(n + 1)]

def run(r, bk=0):
	for i in range(1, m + 1) if bk == 0 else range(m, 0, -1):
		if vis[r][i] == 0:
			vis[r][i] = 1
			print(r, i)
vis[x][y] = 1
print(x, y)
vis[1][y] = 1
print(1, y)
for i in range(1, n + 1):
	run(i, i & 1 ^ 1)


def printrow(y: int, n: int, status: bool):
	if status:
		for i in range(1, n + 1):
			print(i, y)
	else:
		for i in range(n, 0, -1):
			print(i, y)
(N, M, X, Y) = list(map(int, input().split()))
xi = X
yi = Y
while xi <= N:
	print(xi, yi)
	xi += 1
xi = X - 1
while xi:
	print(xi, yi)
	xi -= 1
status = True
for row in range(1, M + 1):
	if row == Y:
		continue
	printrow(row, N, status)
	status = not status


from sys import stdin, stdout
(n, m, x, y) = map(int, stdin.readline().split())
cnt = 0
(mix, mx, miy, my) = (0, x, 0, y)
for i in range(x, 0, -1):
	print(i, y)
for i in range(x + 1, n + 1):
	print(i, y)
ch = 1
for k in range(y + 1, m + 1):
	if ch:
		for j in range(n, 0, -1):
			print(j, k)
		ch ^= 1
	else:
		for j in range(1, n + 1):
			print(j, k)
		ch ^= 1
for k in range(y - 1, 0, -1):
	if ch:
		for j in range(n, 0, -1):
			print(j, k)
		ch ^= 1
	else:
		for j in range(1, n + 1):
			print(j, k)
		ch ^= 1


import sys
import math
from collections import Counter, defaultdict
input = sys.stdin.readline
LI = lambda : list(map(int, input().split()))
MAP = lambda : map(int, input().split())
IN = lambda : int(input())
S = lambda : input()

def print1(n, m):
	for i in range(1, m + 1):
		print(n, i)

def print2(n, m):
	for i in range(m, 0, -1):
		print(n, i)

def case():
	(n, m, p, q) = MAP()
	x = p
	f = [0] * n
	print(p, q)
	for i in range(1, m + 1):
		if i != q:
			print(p, i)
	for i in range(n - 1):
		p += 1
		if p == n + 1:
			p = 1
		if i % 2 == 0:
			print2(p, m)
		else:
			print1(p, m)
for _ in range(1):
	case()


import math
from collections import deque
from sys import stdin, stdout
from string import ascii_letters
input = stdin.readline
letters = ascii_letters[:26]
(n, m, x, y) = list(map(int, input().split()))
print(x, y)
for i in range(x, n + 1):
	if i % 2:
		for g in range(1, m + 1):
			if (i, g) == (x, y):
				continue
			print(i, g)
	else:
		for g in range(m, 0, -1):
			if (i, g) == (x, y):
				continue
			print(i, g)
inv = n % 2
for i in range(1, x):
	if i % 2 if not inv else 1 - i % 2:
		for g in range(1, m + 1):
			if (i, g) == (x, y):
				continue
			print(i, g)
	else:
		for g in range(m, 0, -1):
			if (i, g) == (x, y):
				continue
			print(i, g)


from sys import stdin, stdout, setrecursionlimit
from math import gcd, ceil, sqrt
from collections import Counter, deque
from bisect import bisect_left, bisect_right
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
setrecursionlimit(100000)
mod = 1000000007
(n, m, x, y) = iia()
ans = []
for i in range(1, x + 1)[::-1]:
	ans.append([i, y])
for j in range(x + 1, n + 1):
	ans.append([j, y])
flag = True
for i in range(1, m + 1):
	if i != y:
		if flag:
			f = -1
			flag = False
		else:
			f = 1
			flag = True
		for j in range(1, n + 1)[::f]:
			ans.append([j, i])
for i in ans:
	print(*i)


arr = list(map(int, input().split()))
print(arr[2], arr[3])
count = 1
x = arr[2] - 1
while x != 0:
	print(x, arr[3])
	x -= 1
x = arr[2] + 1
if x == arr[0]:
	print(x, arr[3])
else:
	while x != arr[0] + 1:
		print(x, arr[3])
		x += 1
if (arr[1] - arr[3]) % 2 == 0:
	flag = 0
	for i in range(arr[3] + 1, arr[1] + 1):
		if flag == 0:
			for j in range(arr[0], 0, -1):
				print(j, i)
			flag = 1
		else:
			for j in range(1, arr[0] + 1):
				print(j, i)
			flag = 0
	flag = 0
	for i in range(arr[3] - 1, 0, -1):
		if flag == 0:
			for j in range(arr[0], 0, -1):
				print(j, i)
			flag = 1
		else:
			for j in range(1, arr[0] + 1):
				print(j, i)
			flag = 0
else:
	flag = 0
	for i in range(arr[3] + 1, arr[1] + 1):
		if flag == 0:
			for j in range(arr[0], 0, -1):
				print(j, i)
			flag = 1
		else:
			for j in range(1, arr[0] + 1):
				print(j, i)
			flag = 0
	flag = 0
	for i in range(arr[3] - 1, 0, -1):
		if flag == 0:
			for j in range(1, arr[0] + 1):
				print(j, i)
			flag = 1
		else:
			for j in range(arr[0], 0, -1):
				print(j, i)
			flag = 0


(row, col, x, y) = map(int, input().split())
for i in range(y, col + 1):
	print(x, i)
for i in range(y - 1, 0, -1):
	print(x, i)
flag = 1
for i in range(1, row + 1):
	if flag and i != x:
		for j in range(1, col + 1):
			print(i, j)
		flag = 0
	elif not flag and i != x:
		for j in range(col, 0, -1):
			print(i, j)
		flag = 1


(n, m, sx, sy) = [int(i) for i in input().split()]
for l in [sx] + [x for x in range(1, n + 1) if x != sx]:
	for r in [sy] + [y for y in range(1, m + 1) if y != sy]:
		print(l, r)
		sy = r


import sys
from math import sqrt, gcd, ceil, log, floor
from collections import defaultdict, Counter, deque
from heapq import heapify, heappush, heappop
input = sys.stdin.readline
read = lambda : list(map(int, input().strip().split()))

def main():
	(n, m, x, y) = read()
	visited = defaultdict(int)
	ans = []
	for i in range(x, n + 1):
		visited[i, y] = 1
		ans.append((i, y))
	for i in range(min(y + 1, m + 1), m + 1):
		visited[n, i] = 1
		ans.append((n, i))
	for i in range(n, 0, -1):
		curr = ans[-1]
		(a, b) = curr
		for j in range(b, m + 1):
			if not visited[i, j]:
				ans.append((i, j))
		for j in range(1, b):
			if not visited[i, j]:
				ans.append((i, j))
	for i in ans:
		print(*i)
main()


(n, m, x, y) = map(int, input().split())
ix = x
iy = y
while y <= m:
	print(x, y)
	y += 1
y = iy - 1
while y > 0:
	print(x, y)
	y -= 1
y = 1
x += 1
for i in range(n - 1):
	if y == 1:
		while y <= m:
			print(x, y)
			y += 1
		y -= 1
		if x == n:
			x = 1
		else:
			x += 1
	else:
		while y > 0:
			print(x, y)
			y -= 1
		y = 1
		if x == n:
			x = 1
		else:
			x += 1


from sys import stdin, stdout
import math, sys, heapq
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict
from os import path
import bisect as bi

def yes():
	print('YES')

def no():
	print('NO')
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

	def I():
		return int(input())

	def In():
		return map(int, input().split())
else:

	def I():
		return int(stdin.readline())

	def In():
		return map(int, stdin.readline().split())

def dict(a):
	d = {}
	for x in a:
		if d.get(x, -1) != -1:
			d[x] += 1
		else:
			d[x] = 1
	return d

def find_gt(a, x):
	i = bi.bisect_right(a, x)
	if i != len(a):
		return i
	else:
		return -1

def main():
	try:
		(n, m, x, y) = In()
		ans = []
		for i in range(x, 1, -1):
			ans.append([i, y])
		for j in range(x + 1, n + 1):
			ans.append([j, y])
		q = 0
		for j in range(y - 1, 0, -1):
			if q == 0:
				for i in range(n, 1, -1):
					ans.append([i, j])
				q = 1
			else:
				for i in range(2, n + 1, +1):
					ans.append([i, j])
				q = 0
		for j in range(1, y + 1):
			ans.append([1, j])
		q = 0
		for j in range(y + 1, m + 1):
			if q == 0:
				for i in range(1, n + 1):
					ans.append([i, j])
				q = 1
			else:
				for i in range(n, 0, -1):
					ans.append([i, j])
				q = 0
		for x in ans:
			print(*x)
	except:
		pass
M = 998244353
P = 1000000007
for _ in range(1):
	main()


[n, m, Sx, Sy] = list(map(int, input().split()))
print(Sx, Sy)
(x, y) = (Sx, 1)
while y <= m:
	if y != Sy:
		print(x, y)
	y += 1
(direction, x) = ('L', Sx - 1)
while x > 0:
	if direction == 'L':
		y = m
		while y > 0:
			print(x, y)
			y -= 1
		direction = 'R'
	else:
		y = 1
		while y <= m:
			print(x, y)
			y += 1
		direction = 'L'
	x -= 1
x = Sx + 1
while x <= n:
	if direction == 'L':
		y = m
		while y > 0:
			print(x, y)
			y -= 1
		direction = 'R'
	else:
		y = 1
		while y <= m:
			print(x, y)
			y += 1
		direction = 'L'
	x += 1


(n, m, sx, sy) = map(int, input().split())
l1 = []
check = []
l1.append([sx, sy])
check.append([sx, sy])
if [1, sy] not in check:
	l1.append([1, sy])
	check.append([1, sy])
if [1, 1] not in check:
	l1.append([1, 1])
	check.append([1, 1])
curr = 1
while curr <= n:
	if curr % 2 == 0:
		for i in range(m, 0, -1):
			if [curr, i] not in check:
				l1.append([curr, i])
		curr = curr + 1
	else:
		for i in range(1, m + 1):
			if [curr, i] not in check:
				l1.append([curr, i])
		curr = curr + 1
for i in l1:
	print(*i)


(a, b, c, d) = map(int, input().split())
p = d
while p > 0:
	print(c, p)
	p -= 1
p = d + 1
while p <= b:
	print(c, p)
	p += 1
w = c - 1
p = b
t = 0
while w > 0:
	if t == 0:
		p = b
		while p > 0:
			print(w, p)
			p -= 1
	else:
		p = 1
		while p <= b:
			print(w, p)
			p += 1
	w -= 1
	if t == 0:
		t = 1
	else:
		t = 0
w = c + 1
while w <= a:
	if t == 0:
		p = b
		while p > 0:
			print(w, p)
			p -= 1
	else:
		p = 1
		while p <= b:
			print(w, p)
			p += 1
	w += 1
	if t == 0:
		t = 1
	else:
		t = 0


import sys
input = sys.stdin.readline

def inInt():
	return int(input())

def inStr():
	return input().strip('\n')

def inIList():
	return list(map(int, input().split()))

def inSList():
	return input().split()
case = inIList()
n = case[1]
m = case[0]
(sx, sy) = (case[2], case[3])
(cx, cy) = (sx, sy)
for i in range(m - sx + 1):
	print(sx + i, sy)
for i in range(1, sx):
	print(sx - i, sy)
sx = 1
sy -= 1
while sy > 0:
	print(sx, sy)
	for i in range(m - 1):
		sx += 1
		print(sx, sy)
	sy -= 1
	if sy == 0:
		break
	print(sx, sy)
	for i in range(m - 1):
		sx -= 1
		print(sx, sy)
	sy -= 1
sy = cy + 1
if sx == 1:
	while sy <= n:
		print(sx, sy)
		for i in range(m - 1):
			sx += 1
			print(sx, sy)
		sy += 1
		if sy > n:
			break
		print(sx, sy)
		for i in range(m - 1):
			sx -= 1
			print(sx, sy)
		sy += 1
elif sx == m:
	while sy <= n:
		print(sx, sy)
		for i in range(m - 1):
			sx -= 1
			print(sx, sy)
		sy += 1
		if sy > n:
			break
		print(sx, sy)
		for i in range(m - 1):
			sx += 1
			print(sx, sy)
		sy += 1


def check(grid):
	for row in grid:
		for sq in row:
			if sq == '':
				return False
	return True

def print_grid(grid):
	for line in grid:
		print(line)
inp = list(map(int, input('').split()))
(current_position_x, current_position_y) = (inp[3], inp[2])
grid = [[''] * inp[1] for _ in range(inp[0])]
grid[current_position_y - 1][current_position_x - 1] = '1'
squares = [[current_position_y, current_position_x]]
counter = 1
while not check(grid):
	for i in range(0, len(grid)):
		for x in range(0, len(grid[i])):
			if grid[i][x] == '':
				if i + 1 == current_position_y:
					squares.append([i + 1, x + 1])
					current_position_y = i + 1
					current_position_x = x + 1
					grid[i][x] = counter + 1
					counter += 1
					break
				elif x + 1 == current_position_x:
					squares.append([i + 1, x + 1])
					current_position_x = x + 1
					current_position_y = i + 1
					grid[i][x] = counter + 1
					counter += 1
					break
for sq in squares:
	print(f'{sq[0]} {sq[1]}')


(n, m, x, y) = map(int, input().split())
i = x
f = 0
flag = 0
print(x, y, sep=' ')
for a in range(n):
	if flag == 0:
		j = 1
		for b in range(m):
			if j == y and i == x:
				pass
			else:
				print(i, j, sep=' ')
			j += 1
		flag = 1
	else:
		j = m
		for b in range(m):
			print(i, j, sep=' ')
			j -= 1
		flag = 0
	if i == 1:
		f = 1
		i = x + 1
	elif i > 1 and f != 1:
		i -= 1
	else:
		i += 1


(n, m, S_x, S_y) = map(int, input().split())
y = S_y
for x in range(S_x):
	print(S_x - x, y)
x = S_x - x
for x in range(S_x + 1, n + 1):
	print(x, y)
x_new = x
for y in range(1, S_y):
	if x == 1:
		for X in range(1, n + 1):
			x_new = X
			print(X, S_y - y)
	else:
		for X in range(n):
			x_new = x - X
			print(x - X, S_y - y)
	if x == 1:
		x = X
	else:
		x = x - X
x = x_new
for y in range(S_y + 1, m + 1):
	if x == 1:
		for X in range(1, n + 1):
			print(X, y)
	else:
		for X in range(n):
			print(x - X, y)
	if x == 1:
		x = X
	else:
		x = x - X


def main():
	(n, m, fx, fy) = map(int, input().split())
	(sx, sy) = (1, fy)
	ANS = []
	ANS.append((fx, fy))
	if fx != 1:
		ANS.append((sx, sy))
	for i in range(1, n + 1):
		if i % 2 == 1:
			for j in range(1, m + 1):
				if i == fx and j == fy or (i == sx and j == fy):
					continue
				ANS.append((i, j))
		else:
			for j in range(m, 0, -1):
				if i == fx and j == fy or (i == sx and j == fy):
					continue
				ANS.append((i, j))
	print('\n'.join([' '.join(map(str, ans)) for ans in ANS]))
main()


(n, m, sx, sy) = list(map(int, input().split()))
sx -= 1
sy -= 1
dp = [[False for k in range(0, m)] for h in range(0, n)]
for y in range(sy, -1, -1):
	if dp[sx][y] == False:
		print(' '.join([str(sx + 1), str(y + 1)]))
		dp[sx][y] = True
for y in range(sy + 1, m):
	if dp[sx][y] == False:
		print(' '.join([str(sx + 1), str(y + 1)]))
		dp[sx][y] = True
sy = y
for x in range(sx, -1, -1):
	if dp[x][sy] == False:
		print(' '.join([str(x + 1), str(sy + 1)]))
		dp[x][sy] = True
for x in range(sx + 1, n):
	if dp[x][sy] == False:
		print(' '.join([str(x + 1), str(sy + 1)]))
		dp[x][sy] = True
sx = x
sy -= 1
while sy >= 0:
	for x in range(sx, -1, -1):
		if dp[x][sy] == False:
			print(' '.join([str(x + 1), str(sy + 1)]))
			dp[x][sy] = True
	sy -= 1
	sx = x
	if sy >= 0:
		for x in range(sx, n):
			if dp[x][sy] == False:
				print(' '.join([str(x + 1), str(sy + 1)]))
				dp[x][sy] = True
	sx = x
	sy -= 1


(n, m, x_real, y_real) = map(int, input().split())
(x, y) = (x_real, y_real)
while x <= n:
	print(x, y)
	x += 1
x = x_real
while x > 1:
	x -= 1
	print(x, y)
while y > 1:
	y -= 1
	if x == 1:
		while x <= n:
			print(x, y)
			x += 1
		x = n
	elif x == n:
		while x >= 1:
			print(x, y)
			x -= 1
		x = 1
y = y_real + 1
while y <= m:
	if x == 1:
		while x <= n:
			print(x, y)
			x += 1
		x = n
	elif x == n:
		while x >= 1:
			print(x, y)
			x -= 1
		x = 1
	y += 1


def answer(n, m, x, y):
	d = {(x, y): 1, (1, y): 1}
	l = [[x, y], [1, y]]
	flag = 0
	for i in range(1, n + 1):
		if flag == 0:
			for j in range(1, m + 1):
				if (i, j) not in d:
					l.append([i, j])
			flag = 1
		elif flag == 1:
			for j in range(m, 0, -1):
				if (i, j) not in d:
					l.append([i, j])
			flag = 0
	return l
(n, m, x, y) = map(int, input().split())
l = answer(n, m, x, y)
for i in l:
	print(*i)


(n, m, x, y) = map(int, input().split())
curr = (x, y)
arr = []
arr.append(curr)
for var_y in range(1, m + 1):
	if var_y != y:
		curr = (x, var_y)
		arr.append(curr)
counter_above = x - 1
var_y = curr[1]
while counter_above:
	if var_y <= 1:
		addeum = 1
	else:
		addeum = -1
	for _ in range(1, m + 1):
		curr = (counter_above, var_y)
		arr.append(curr)
		var_y += addeum
	if var_y <= 1:
		var_y = 1
	else:
		var_y = m
	counter_above -= 1
counter_below = x + 1
var_y = curr[1]
while counter_below <= n:
	if var_y <= 1:
		addeum = 1
	else:
		addeum = -1
	for _ in range(1, m + 1):
		curr = (counter_below, var_y)
		arr.append(curr)
		var_y += addeum
	if var_y <= 1:
		var_y = 1
	else:
		var_y = m
	counter_below += 1
for item in arr:
	print(item[0], item[1])


import sys, math
input = sys.stdin.readline
(n, m, sx, sy) = map(int, input().split())
sx -= 1
sy -= 1
mat = []
for i in range(n):
	temp = [0] * m
	mat.append(temp)
counter = 2
mat[sx][sy] = 1
for i in range(sy - 1, -1, -1):
	mat[sx][i] = counter
	counter += 1
for i in range(sy + 1, m):
	mat[sx][i] = counter
	counter += 1
toggle = 0
for i in range(sx - 1, -1, -1):
	if toggle == 0:
		for j in range(m - 1, -1, -1):
			mat[i][j] = counter
			counter += 1
		toggle = 1
	else:
		for j in range(m):
			mat[i][j] = counter
			counter += 1
		toggle = 0
toggle2 = 1
if toggle == 1:
	toggle2 = 0
for i in range(sx + 1, n):
	if toggle2 == 1:
		for j in range(m - 1, -1, -1):
			mat[i][j] = counter
			counter += 1
		toggle2 = 0
	else:
		for j in range(m):
			mat[i][j] = counter
			counter += 1
		toggle2 = 1
l = []
for i in range(n):
	for j in range(m):
		l.append([mat[i][j], (i + 1, j + 1)])
l.sort(key=lambda x: x[0])
for i in l:
	print(i[1][0], i[1][1])


import sys

def main():
	(n, m, sx, sy) = map(int, sys.stdin.readline().split())
	P = [(sx, sy), (1, sy), (1, 1)]
	dy = 1
	(tx, ty) = (1, 1)
	for i in range(1, n + 1):
		for j in range(1, m + 1):
			ty += dy
			if ty > m:
				tx += 1
				ty = m
				dy = -dy
			elif ty < 1:
				tx += 1
				ty = 1
				dy = -dy
			elif tx == 1 and ty == sy or (tx == sx and ty == sy):
				continue
			P.append((tx, ty))
	print('\n'.join((' '.join(map(str, p)) for p in P[:-1])))
main()


(n, m, sx, sy) = map(int, input().split())
book = [[0 for i in range(m + 1)] for i in range(n + 1)]
print(sx, sy)
print(1, sy)
book[sx][sy] == 1
book[1][sy] == 1
for i in range(1, n + 1):
	if i % 2 == 0:
		j = m
		while j >= 1:
			if not (i == 1 and j == sy or (i == sx and j == sy)):
				print(i, j)
			j -= 1
	else:
		j = 1
		while j <= m:
			if not (i == 1 and j == sy or (i == sx and j == sy)):
				print(i, j)
			j += 1


(n, m, sx, sy) = map(int, input().split(' '))
mtr = [[0 for i in range(m)] for j in range(n)]
f = True
for j in range(sy - 1, -1, -1):
	mtr[sx - 1][j] = 1
	print(sx, j + 1)
f = 1
for j in range(0, m):
	if f == 1:
		for i in range(n - 1, -1, -1):
			if mtr[i][j] == 1:
				continue
			else:
				mtr[i][j] = 1
				print(i + 1, j + 1)
		f = 0
	elif f == 0:
		for i in range(0, n):
			if mtr[i][j] == 1:
				continue
			else:
				mtr[i][j] = 1
				print(i + 1, j + 1)
		f = 1


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
from collections import Counter
inp = lambda : int(input())
strng = lambda : input().strip()
jn = lambda x, l: x.join(map(str, l))
strl = lambda : list(input().strip())
mul = lambda : map(int, input().strip().split())
mulf = lambda : map(float, input().strip().split())
seq = lambda : list(map(int, input().strip().split()))
ceil = lambda x: int(x) if x == int(x) else int(x) + 1
ceildiv = lambda x, d: x // d if x % d == 0 else x // d + 1
flush = lambda : stdout.flush()
stdstr = lambda : stdin.readline()
stdint = lambda : int(stdin.readline())
stdpr = lambda x: stdout.write(str(x))
stdarr = lambda : map(int, stdstr().split())
mod = 1000000007
(n, m, x, y) = stdarr()
res = []
res.append([x, y])
for i in range(y + 1, m + 1):
	res.append([x, i])
for i in range(y - 1, 0, -1):
	res.append([x, i])
xx = 0
for i in range(1, n + 1):
	if i == x:
		continue
	if xx % 2 == 0:
		for j in range(1, m + 1):
			res.append([i, j])
	else:
		for j in range(m, 0, -1):
			res.append([i, j])
	xx += 1
for i in res:
	print(*i)


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
import copy
mod = int(pow(10, 9) + 7)
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def L():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
try:
	sys.stdin = open('input.txt', 'r')
except:
	pass
for _ in range(1):
	(n, m, sx, sy) = L()
	print(sx, sy)
	for i in range(sy + 1, m + 1):
		print(sx, i)
	for i in range(sy - 1, 0, -1):
		print(sx, i)
	last = 0
	for i in range(sx - 1, 0, -1):
		if last == 0:
			for j in range(1, m + 1):
				print(i, j)
			last = 1
		else:
			for j in range(m, 0, -1):
				print(i, j)
			last = 0
	for i in range(sx + 1, n + 1):
		if last == 0:
			for j in range(1, m + 1):
				print(i, j)
			last = 1
		else:
			for j in range(m, 0, -1):
				print(i, j)
			last = 0


ip = input()
ls = ip.split()
n = int(ls[0])
m = int(ls[1])
x = int(ls[2])
y = int(ls[3])
tmpx = x - 1
tmpy = y
print(x, y)
while tmpx > 0:
	print(tmpx, tmpy)
	tmpx -= 1
tmpx = x + 1
while tmpx <= n:
	print(tmpx, tmpy)
	tmpx += 1
level = 'down'
tmpx = n
tmpy = y - 1
while tmpy > 0:
	if tmpx == 0:
		tmpx = 1
	if tmpx == n + 1:
		tmpx = n
	if level == 'down':
		level = 'up'
		while tmpx > 0:
			print(tmpx, tmpy)
			tmpx -= 1
		tmpy -= 1
	elif level == 'up':
		level = 'down'
		while tmpx <= n:
			print(tmpx, tmpy)
			tmpx += 1
		tmpy -= 1
tmpy = y + 1
while tmpy <= m:
	if tmpx == 0:
		tmpx = 1
	if tmpx == n + 1:
		tmpx = n
	if level == 'down':
		level = 'up'
		while tmpx > 0:
			print(tmpx, tmpy)
			tmpx -= 1
		tmpy += 1
	elif level == 'up':
		level = 'down'
		while tmpx <= n:
			print(tmpx, tmpy)
			tmpx += 1
		tmpy += 1


(n, m, sx, sy) = map(int, input().split())
for i in range(sx, 0, -1):
	print(i, sy)
for i in range(sx + 1, n + 1):
	print(i, sy)
down = False
for i in range(1, sy):
	down = not down
	if down:
		for j in range(n, 0, -1):
			print(j, i)
	else:
		for j in range(1, n + 1):
			print(j, i)
for i in range(sy + 1, m + 1):
	down = not down
	if down:
		for j in range(n, 0, -1):
			print(j, i)
	else:
		for j in range(1, n + 1):
			print(j, i)


(n, m, sx, sy) = map(int, input().split())
a = [[0 for i in range(m)] for j in range(n)]
a[sx - 1][sy - 1] = 1
print(sx, sy)
(i, j) = (sx - 1, 0)
while j < m:
	if a[i][j] == 0:
		a[i][j] == 1
		print(i + 1, j + 1)
	j += 1
(i, j) = (0, m - 1)
ltr = False
while i < n:
	if ltr == True:
		if a[i][j] == 0:
			a[i][j] == 1
			print(i + 1, j + 1)
		j += 1
		if j >= m:
			i += 1
			j = m - 1
			ltr = False
			if i == sx - 1:
				i += 1
	else:
		if a[i][j] == 0:
			a[i][j] == 1
			print(i + 1, j + 1)
		j -= 1
		if j < 0:
			i += 1
			j = 0
			ltr = True
			if i == sx - 1:
				i += 1


t = [int(item) for item in input().split()]
n = t[0]
m = t[1]
x = t[2]
y = t[3]
goLeft = True
X = x
Y = y
print(x, y)
for i in range(1, y):
	print(x, y - i)
for i in range(1, m - y + 1):
	print(x, y + i)
for i in range(1, x):
	for j in range(1, m + 1):
		if goLeft:
			print(x - i, m - j + 1)
		else:
			print(x - i, j)
	goLeft = not goLeft
x = X
y = Y
for i in range(1, n - x + 1):
	for j in range(1, m + 1):
		if goLeft:
			print(x + i, m - j + 1)
		else:
			print(x + i, j)
	goLeft = not goLeft


(m, n, sx, sy) = list(map(int, input().split()))
(cx, cy) = (sx, sy)
print(sx, sy)
while cx < m:
	cx += 1
	print(cx, cy)
(cx, cy) = (sx - 1, sy)
print(cx, cy)
dir = -1
while cy > 0:
	while dir == -1 and cx > 1 or (dir == 1 and cx < m):
		cx += dir
		print(cx, cy)
	dir *= -1
	cy -= 1
	if 0 < cx <= m and 0 < cy <= n:
		print(cx, cy)
cy = sy + 1
if 0 < cx <= m and 0 < cy <= n:
	print(cx, cy)
if cx == 1:
	dir = 1
else:
	dir = -1
while cy <= n:
	while dir == -1 and cx > 1 or (dir == 1 and cx < m):
		cx += dir
		print(cx, cy)
	dir *= -1
	cy += 1
	if 0 < cx <= m and 0 < cy <= n:
		print(cx, cy)


from collections import *
from math import *
(n, m, x, y) = map(int, input().split())
print(x, y)
for i in range(1, m + 1):
	if i != y:
		print(x, i)
f = 0
for i in range(1, x):
	if f:
		for j in range(1, m + 1):
			print(i, j)
		f = 0
	else:
		for j in range(m, 0, -1):
			print(i, j)
		f = 1
for i in range(x + 1, n + 1):
	if f:
		for j in range(1, m + 1):
			print(i, j)
		f = 0
	else:
		for j in range(m, 0, -1):
			print(i, j)
		f = 1


(n, m, Sx, Sy) = map(int, input().split())
x = []
y = []
m = m + 1
count = 1
increasing = False
for k in range(m - 1):
	x.append(Sx)
	y.append(k + 1)
y.remove(Sy)
x.remove(Sx)
for j in range(n - 1):
	for i in range(m - 1):
		x.append(count)
		if increasing == False:
			y.append(abs(i - (m - 1)))
		elif increasing == True:
			y.append(i + 1)
	count += 1
	if count == Sx:
		count += 1
	increasing = not increasing
print(Sx, Sy)
for l in range(len(x)):
	print(x[l], y[l])


(n, m, x, y) = map(int, input().split())
sx = []
sy = []
sx.append(x)
sy.append(y)
j = 1
for i in range(x, n + 1):
	if j == 1:
		for j in range(1, m + 1):
			if i == x and j == y:
				continue
			else:
				sx.append(i)
				sy.append(j)
	elif j == m:
		for j in range(m, 0, -1):
			if i == x and j == y:
				continue
			else:
				sx.append(i)
				sy.append(j)
z = j
for i in range(1, x):
	if j == 1:
		for j in range(1, m + 1):
			if i == x and j == y:
				continue
			else:
				sx.append(i)
				sy.append(j)
	elif j == m:
		for j in range(m, 0, -1):
			if i == x and j == y:
				continue
			else:
				sx.append(i)
				sy.append(j)
for k in range(len(sx)):
	print(sx[k], sy[k])


import sys
RI = lambda : [int(x) for x in sys.stdin.readline().strip().split()]
rw = lambda : sys.stdin.readline().strip().split()
ri = lambda : int(sys.stdin.readline().strip())
rs = lambda : sys.stdin.readline().strip()
from collections import defaultdict as df
import random
from queue import PriorityQueue as pq
from math import ceil
(n, m, x, y) = RI()
done = df(int)
for i in range(y, 0, -1):
	print(x, i)
for i in range(y + 1, m + 1, 1):
	print(x, i)
rev = 1
for i in range(x - 1, 0, -1):
	if rev == 1:
		for j in range(m, 0, -1):
			print(i, j)
		rev = 0
	else:
		for j in range(1, m + 1, 1):
			print(i, j)
		rev = 1
for i in range(x + 1, n + 1, 1):
	if rev == 1:
		for j in range(m, 0, -1):
			print(i, j)
		rev = 0
	else:
		for j in range(1, m + 1, 1):
			print(i, j)
		rev = 1


(n, m, x, y) = map(int, input().split())
maxx = x
maxy = y
print(x, y)
for i in range(x - 1, 0, -1):
	print(i, y)
for i in range(x + 1, n + 1):
	print(i, y)
l = 0
for i in range(y - 1, 0, -1):
	if l:
		for j in range(1, n + 1):
			print(j, i)
	else:
		for j in range(n, 0, -1):
			print(j, i)
	l = (l + 1) % 2
for j in range(y + 1, m + 1):
	if l:
		for i in range(1, n + 1):
			print(i, j)
	else:
		for i in range(n, 0, -1):
			print(i, j)
	l = (l + 1) % 2


(n, m, row, col) = map(int, input().split())
bads = [(row, col), (row, 1), (1, 1)]
print(row, col)
print(row, 1)
print(1, 1)

def traverse(aCol, lefttoright):
	if lefttoright:
		for roo in range(1, n + 1):
			if (roo, aCol) not in bads:
				print(roo, aCol)
	else:
		for roo in range(n, 0, -1):
			if (roo, aCol) not in bads:
				print(roo, aCol)
for coo in range(1, m + 1):
	if coo & 1:
		traverse(coo, True)
	else:
		traverse(coo, False)


(n, m, a, b) = map(int, input().split())
grid = []
for f in range(n):
	e = []
	for d in range(m):
		e.append(d + 1)
	grid.append(e)
grid[a - 1][b - 1] = 0
print(a, b)
grid[0][b - 1] = 0
print(1, b)
count = 0
for r in grid:
	count += 1
	if count % 2 == 0:
		r = r[::-1]
	for c in r:
		if c != 0:
			print(count, c)


(n, m, sx, sy) = [int(i) for i in input().split(' ')]
print(str(sx) + ' ' + str(sy))
print(str(1) + ' ' + str(sy))
print(str(1) + ' ' + str(1))
ls = [(sx, sy), (1, 1), (1, sy)]
for i in range(1, n + 1):
	for j in range(1, m + 1):
		if i % 2 == 0:
			if (i, m - j + 1) not in ls:
				print(str(i) + ' ' + str(m - j + 1))
		elif (i, j) not in ls:
			print(str(i) + ' ' + str(j))


(a, b, x, y) = map(int, input().split())
visted = 1
while visted < a * b:
	for i in range(b - 1):
		print(x, y)
		y = (y - 1 - 1) % b + 1
		visted += 1
	print(x, y)
	x = (x - 1 - 1) % a + 1
	visted += 1


import io
import os
import sys
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

def prdbg(*args, **kwargs):
	print(*args, file=sys.stderr, **kwargs)

def get_str():
	return input().decode().strip()

def rint():
	return map(int, input().split())

def oint():
	return int(input())
(n, m, x, y) = rint()
print(x, y)
for i in range(m, 0, -1):
	if i != y:
		print(x, i)
r = 1
c = 1
t = 1
for r in range(1, n + 1):
	if r == x:
		continue
	if t:
		for c in range(1, m + 1):
			print(r, c)
	else:
		for c in range(m, 0, -1):
			print(r, c)
	t ^= 1


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush, nsmallest
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
from decimal import Decimal
mod = pow(10, 9) + 7

def data():
	return sys.stdin.readline().strip()

def out(var):
	sys.stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
(n, m, i, j) = sp()
i -= 1
j -= 1
vis = [[0] * m for i in range(n)]
other = set()
cnt = 0
temp = i
while temp < n:
	print(temp + 1, j + 1)
	other.add((temp, j))
	temp += 1
temp = i - 1
while temp >= 0:
	print(temp + 1, j + 1)
	other.add((temp, j))
	temp -= 1
i = 0
if j != 0:
	j -= 1
	while j >= 0:
		print(i + 1, j + 1)
		other.add((i, j))
		j -= 1
j = 0
direction = 1
while cnt != n * m:
	if direction == 1:
		while j < m and (not vis[i][j]):
			if (i, j) not in other:
				print(i + 1, j + 1)
			vis[i][j] = 1
			cnt += 1
			j += 1
		j -= 1
		i += 1
		direction = 2
	elif direction == 2:
		while i < n and (not vis[i][j]):
			if (i, j) not in other:
				print(i + 1, j + 1)
			vis[i][j] = 1
			cnt += 1
			i += 1
		i -= 1
		j -= 1
		direction = 3
	elif direction == 3:
		while j >= 0 and (not vis[i][j]):
			if (i, j) not in other:
				print(i + 1, j + 1)
			vis[i][j] = 1
			cnt += 1
			j -= 1
		j += 1
		i -= 1
		direction = 4
	else:
		while i >= 0 and (not vis[i][j]):
			if (i, j) not in other:
				print(i + 1, j + 1)
			vis[i][j] = 1
			cnt += 1
			i -= 1
		i += 1
		j += 1
		direction = 1


from sys import stdin
input = stdin.readline
(n, m, sx, sy) = map(int, input().split())
cord = None
for row in range(sx, n + 1):
	print(row, sy)
for row in range(sx - 1, 0, -1):
	print(row, sy)
for col in range(sy + 1, m + 1):
	for row in range(1, n + 1):
		if col - sy & 1:
			cord = (row, col)
			print(row, col)
		else:
			cord = (n + 1 - row, col)
			print(n + 1 - row, col)
if cord[0] == 1:
	for col in range(1, sy):
		for row in range(1, n + 1):
			if col & 1:
				print(row, col)
			else:
				print(n + 1 - row, col)
else:
	for col in range(1, sy):
		for row in range(n, 0, -1):
			if col & 1:
				print(row, col)
			else:
				print(n + 1 - row, col)


(n, m, x, y) = map(int, input().split())
arr = [[-1 for i in range(m)] for i in range(n)]
arr[x - 1][y - 1] = 1
print(x, y)
while 1:
	if y - 1 >= 1:
		y -= 1
	else:
		break
	if arr[x - 1][y - 1] == -1:
		arr[x - 1][y - 1] = 1
		print(x, y)
while 1:
	if y + 1 <= m:
		y += 1
	else:
		break
	if arr[x - 1][y - 1] == -1:
		arr[x - 1][y - 1] = 1
		print(x, y)
x = 1
if arr[x - 1][y - 1] == -1:
	arr[x - 1][y - 1] = 1
	print(x, y)
next_move = 'left'
while 1:
	if next_move == 'right':
		if y + 1 <= m:
			y += 1
		else:
			next_move = 'left'
			while x <= n:
				if arr[x - 1][y - 1] == -1:
					arr[x - 1][y - 1] = 1
					print(x, y)
					break
				x += 1
	elif y - 1 >= 1:
		y -= 1
	else:
		next_move = 'right'
		while x <= n:
			if arr[x - 1][y - 1] == -1:
				arr[x - 1][y - 1] = 1
				print(x, y)
				break
			x += 1
	if x > n:
		break
	if arr[x - 1][y - 1] == -1:
		arr[x - 1][y - 1] = 1
		print(x, y)
	else:
		pass


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
(n, m, sx, sy) = map(int, input().split())
moves = [(sx, sy)]
visited = set([(sx, sy)])
cv = 0
for s in range(sy, sy + m):
	if cv % 2 == 0:
		for b in range(1, n + 1):
			if s % m == 0:
				coord = (b, m)
			else:
				coord = (b, s % m)
			if not coord in visited:
				moves.append(coord)
				visited.add(coord)
	else:
		for b in range(n, 0, -1):
			if s % m == 0:
				coord = (b, m)
			else:
				coord = (b, s % m)
			if not coord in visited:
				moves.append(coord)
				visited.add(coord)
	cv += 1
for s in range(len(moves)):
	print(*moves[s])


import sys
input = sys.stdin.readline
print = sys.stdout.write

def main(n, m, a, b):
	visited = []
	for i in range(a - 1, -1, -1):
		visited.append([i + 1, b])
		print(str(i + 1) + ' ' + str(b) + '\n')
	for j in range(b - 2, -1, -1):
		visited.append([1, j + 1])
		print(str(1) + ' ' + str(j + 1) + '\n')
	for i in range(0, n, 2):
		for j in range(m):
			if [i + 1, j + 1] not in visited:
				print(str(i + 1) + ' ' + str(j + 1) + '\n')
		if i != n - 1:
			for j in range(m - 1, -1, -1):
				if [i + 2, j + 1] not in visited:
					print(str(i + 2) + ' ' + str(j + 1) + '\n')
	return
(n, m, a, b) = list(map(int, input().split()))
main(n, m, a, b)


(n, m, x, y) = [int(x) for x in input().split()]
takenCol = y
print(str(x) + ' ' + str(y))
for i in range(n, 0, -1):
	if i != x:
		print(str(i) + ' ' + str(y))
startFromOne = True
for y in range(1, m + 1):
	if y == takenCol:
		continue
	if startFromOne:
		for x in range(1, n + 1):
			print(str(x) + ' ' + str(y))
	else:
		for x in range(n, 0, -1):
			print(str(x) + ' ' + str(y))
	startFromOne = not startFromOne


(n, m, x, y) = input().split()
m = int(m)
n = int(n)
x = int(x)
y = int(y)
print(x, y)
a = x
b = y
print(1, y)
print(1, 1)
x = 1
y = 1
for i in range(n):
	for j in range(m):
		if abs(x) == a and abs(y) == b or (abs(x) == 1 and abs(y) == b) or (x == 1 and y == 1):
			y = y
		else:
			print(x, abs(y))
		y = y + 1
	x += 1
	if y == m + 1:
		y = -y + 1
	else:
		y = 1


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

def do_row(sx, vis):
	last = -1
	for j in range(1, m + 1):
		if (sx, j) not in vis:
			print(sx, j)
			vis.add((sx, j))
			last = j
	return last
vis = set()
vis.add((sx, sy))
print(sx, sy)
l = sy
l2 = do_row(sx, vis)
if l2 != -1:
	l = l2
for i in range(1, n + 1):
	if (i, l) in vis:
		continue
	print(i, l)
	vis.add((i, l))
	l2 = do_row(i, vis)
	if l2 != -1:
		l = l2


import sys
from math import *
(n, m, x, y) = map(int, input().split())
vis = [[0 for j in range(m + 1)] for i in range(n + 1)]
print(x, y)
vis[x][y] = 1
print(1, y)
vis[1][y] = 1
print(1, 1)
vis[1][1] = 1
c = 1
for i in range(1, n + 1):
	if c == 1:
		a = 1
		b = m + 1
	else:
		a = m
		b = 0
	for j in range(a, b, c):
		if not vis[i][j]:
			print(i, j)
			vis[i][j] = 1
	c = -c


(R, C, rStart, cStart) = map(int, input().split())
result = [(rStart, c) for c in range(cStart, C + 1)]
result.extend(((rStart, c) for c in range(cStart - 1, 0, -1)))
for i in range(R - 1):
	(rp, cp) = result[-1]
	r = rp + 1
	if r > R:
		r = 1
	if cp == 1:
		result.extend(((r, c) for c in range(1, C + 1)))
	else:
		result.extend(((r, c) for c in range(C, 0, -1)))
for row in result:
	print(' '.join(map(str, row)))


(n, m, S_x, S_y) = map(int, input().split())
for y in list(range(S_y, 0, -1)) + list(range(S_y + 1, m + 1, 1)):
	print(S_x, y)
for x in list(range(S_x - 1, 0, -1)) + list(range(S_x + 1, n + 1, 1)):
	print(x, m)
c = 0
for x in range(n, 0, -1):
	if x == S_x:
		continue
	if c % 2 == 0:
		itr = range(m - 1, 0, -1)
	else:
		itr = range(1, m, 1)
	for y in itr:
		print(x, y)
	c += 1


def main():
	(n, m, x, y) = map(int, input().split())
	print(x, y)
	i = x
	j = y
	while True:
		i = i - 1
		if i == 0:
			break
		print(i, j)
	i = x + 1
	j = y
	while i <= n:
		print(i, j)
		i = i + 1
	for p in range(y + 1, m + 1):
		if (p - y) % 2 == 0:
			for q in range(1, n + 1):
				print(q, p)
		else:
			for q in range(n, 0, -1):
				print(q, p)
	c = 0
	if p * q == n * m:
		c = 0
	else:
		c = 1
	for p in range(y - 1, 0, -1):
		if c == 1:
			c = 0
			for q in range(1, n + 1):
				print(q, p)
		elif c == 0:
			c = 1
			for q in range(n, 0, -1):
				print(q, p)
main()


(n, m, x, y) = map(int, input().split())
xset = set(range(1, n + 1))
yset = set(range(1, m + 1))
xset.remove(x)
print(x, y)
for y in yset - {y}:
	print(x, y)
while xset:
	x = xset.pop()
	print(x, y)
	for y in yset - {y}:
		print(x, y)


(n, m, x, y) = map(int, input().split())
print(x, y)
for i in range(1, m + 1):
	if i != y:
		print(x, i)
for i in range(1, x):
	for j in list(range(1, m + 1))[::(1 - i % 2) * 2 - 1]:
		print(i, j)
for i in range(x + 1, n + 1):
	for j in list(range(1, m + 1))[::i % 2 * 2 - 1]:
		print(i, j)


def res_print(row, col):
	print(str(row) + ' ' + str(col))

def sol(num_rows, num_cols, start_row, start_col):
	res_print(start_row, start_col)
	row = start_row
	while row > 1:
		row -= 1
		res_print(row, start_col)
	row = start_row
	while row < num_rows:
		row += 1
		res_print(row, start_col)
	col = start_col
	while col > 1:
		col -= 1
		if row == 1:
			res_print(row, col)
			while row < num_rows:
				row += 1
				res_print(row, col)
		else:
			res_print(row, col)
			while row > 1:
				row -= 1
				res_print(row, col)
	col = start_col
	while col < num_cols:
		col += 1
		if row == 1:
			res_print(row, col)
			while row < num_rows:
				row += 1
				res_print(row, col)
		else:
			res_print(row, col)
			while row > 1:
				row -= 1
				res_print(row, col)

def main():
	(num_rows, num_cols, start_row, start_col) = list(map(int, input().split()))
	sol(num_rows, num_cols, start_row, start_col)
main()


(n, m, x, y) = map(int, input().split())
a = [[0 for i in range(m)] for j in range(n)]
sx = x
sy = y
f = 0
while y <= m:
	if a[x - 1][y - 1] == 0:
		print(x, y)
		a[x - 1][y - 1] = 1
	y += 1
y = sy - 1
while y > 0:
	if a[x - 1][y - 1] == 0:
		print(x, y)
		a[x - 1][y - 1] = 1
	y -= 1
x -= 1
y += 1
while x > 0:
	if y == 1:
		for i in range(1, m + 1):
			print(x, i)
		y = m
	else:
		for i in range(m, 0, -1):
			print(x, i)
		y = 1
	x -= 1
x = sx + 1
while x <= n:
	if y == 1:
		for i in range(1, m + 1):
			print(x, i)
		y = m
	else:
		for i in range(m, 0, -1):
			print(x, i)
		y = 1
	x += 1


import sys
input = sys.stdin.buffer.readline
inin = lambda : int(input())
inar = lambda : list(map(int, input().split()))
inst = lambda : input().decode().rstrip('\n\r')
INF = float('inf')
_T_ = 1
for _t_ in range(_T_):
	(n, m, x, y) = inar()
	cx = x
	print(x, y)
	move = 1
	for j in range(y - 1, 0, -1):
		print(x, j)
	for j in range(y + 1, m + 1):
		print(x, j)
	while x < n:
		move = -move
		x += 1
		if move == -1:
			for j in range(m, 0, -1):
				print(x, j)
		if move == 1:
			for j in range(1, m + 1):
				print(x, j)
	x = 0
	while x < cx - 1:
		move = -move
		x += 1
		if move == -1:
			for j in range(m, 0, -1):
				print(x, j)
		if move == 1:
			for j in range(1, m + 1):
				print(x, j)


for _ in range(1):
	(n, m, sx, sy) = map(int, input().split())
	print(sx, sy)
	for i in range(1, n + 1):
		if i == sx:
			continue
		print(i, sy)
	bo = True
	for y in range(1, m + 1):
		if y == sy:
			continue
		if bo:
			for x in range(n, 0, -1):
				print(x, y)
			bo = False
		else:
			for x in range(1, n + 1):
				print(x, y)
			bo = True


(n, m, sx, sy) = map(int, input().split())
r = sx
c = sy
for i in range(r, 0, -1):
	print(i, c)
for i in range(r + 1, n + 1):
	print(i, c)
c += 1
last = 1
while c <= m:
	if last == 0:
		for i in range(1, n + 1):
			print(i, c)
			last = 1
	else:
		for i in range(n, 0, -1):
			print(i, c)
			last = 0
	c += 1
c = 1
while c < sy:
	if last == 0:
		for i in range(1, n + 1):
			print(i, c)
			last = 1
	else:
		for i in range(n, 0, -1):
			print(i, c)
			last = 0
	c += 1


mod = 10 ** 9 + 7
(n, m, x, y) = map(int, input().split())
for i in range(y, m + 1):
	print(x, i)
for i in range(y - 1, 0, -1):
	print(x, i)
ch = 0
for i in range(x + 1, n + 1):
	if ch == 0:
		for j in range(1, m + 1):
			print(i, j)
	else:
		for j in range(m, 0, -1):
			print(i, j)
	ch = 1 - ch
for i in range(x - 1, 0, -1):
	if ch == 0:
		for j in range(1, m + 1):
			print(i, j)
	else:
		for j in range(m, 0, -1):
			print(i, j)
	ch = 1 - ch


import sys
input = sys.stdin.readline

def inInt():
	return int(input())

def inStr():
	return input().strip('\n')

def inIList():
	return list(map(int, input().split()))

def inSList():
	return input().split()

def solve(m, n, x, y):
	for i in range(m):
		for j in range(n):
			print(x, y)
			if j < n - 1:
				y = y + 1
				if y == n + 1:
					y = 1
		x = x + 1
		if x == m + 1:
			x = 1
counts = inIList()
solve(counts[0], counts[1], counts[2], counts[3])


import math

def dtb(n):
	return bin(n).replace('0b', '')

def btd(n):
	return int(n, 2)
(n, m, sx, sy) = map(int, input().split())
print(sx, sy)
for j in range(m, 0, -1):
	if j == sy:
		continue
	print(sx, j)
for j in range(1, m + 1):
	if j % 2 == 1:
		for i in range(1, n + 1):
			if i == sx:
				continue
			print(i, j)
	else:
		for i in range(n, 0, -1):
			if i == sx:
				continue
			print(i, j)


(n, m, sx, sy) = map(int, input().split())
(x, y) = (sx, sy)
while x >= 1:
	print(x, y)
	x -= 1
x = sx + 1
while x <= n:
	print(x, y)
	x += 1
x -= 1
y -= 1
while y >= 1:
	if x >= n:
		x = n
		while x > 0:
			print(x, y)
			x -= 1
	else:
		while x <= n:
			if x == 0:
				x = 1
			print(x, y)
			x += 1
	y -= 1
y = sy + 1
while y <= m:
	if x == 0:
		x = 1
	else:
		x = n
	if x == n:
		while x > 0:
			print(x, y)
			x -= 1
	else:
		while x <= n:
			print(x, y)
			x += 1
	y += 1


(n, m, x, y) = [int(x) for x in input().split()]
for i in range(y, m + 1):
	print(x, i)
for i in range(y - 1, 0, -1):
	print(x, i)
d = 'r'
for i in range(1, n + 1):
	if d == 'r' and i != x:
		for j in range(1, m + 1):
			print(i, j)
		d = 'l'
	elif d == 'l' and i != x:
		for j in range(m, 0, -1):
			print(i, j)
		d = 'r'


import math
m = 1000000007

def fact(n):
	ans = 1
	for i in range(1, n + 1):
		ans = ans % m * (i % m) % m
	return ans

def power_2(n):
	ans = 1
	for i in range(n):
		ans = ans % m * 2 % m
	return ans
(n, m, sx, sy) = map(int, input().split())
for j in range(0, sy):
	print(sx, sy - j)
for j in range(sy + 1, m + 1):
	print(sx, j)
(i, j) = (1, m)
while i < sx:
	if i % 2:
		for k in range(0, m):
			print(i, m - k)
	else:
		for k in range(1, m + 1):
			print(i, k)
	i += 1
i += 1
while i <= n:
	if i % 2 == 0:
		for k in range(0, m):
			print(i, m - k)
	else:
		for k in range(1, m + 1):
			print(i, k)
	i += 1


(n, m, x, y) = map(int, input().split())
visited = {(x, y)}
print(x, y)
if x != 1:
	print(1, y)
	visited.add((1, y))
for i in range(1, n + 1):
	for j in range(1, m + 1):
		val = j
		if i % 2 == 0:
			val = m + 1 - j
		cell = (i, val)
		if cell not in visited:
			print(cell[0], cell[1])


A = [int(i) for i in input().split()]
Ans = []
bool = True
Ans.append(f'{A[2]} {A[3]}')
for i in range(0, A[1]):
	if A[1] - i != A[3]:
		Ans.append(f'{A[2]} {A[1] - i}')
for i in range(0, A[0]):
	if i + 1 != A[2]:
		if bool:
			for j in range(0, A[1]):
				Ans.append(f'{i + 1} {j + 1}')
		else:
			for j in range(0, A[1]):
				Ans.append(f'{i + 1} {A[1] - j}')
		bool = not bool
for i in Ans:
	print(i)


from sys import stdin, stdout
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

def inp():
	return stdin.readline().strip()

def iinp():
	return int(inp())

def out(var, end='\n'):
	stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	stdout.write(' '.join(map(str, var)) + end)

def lmp():
	return list(mp())

def mp():
	return map(int, inp().split())

def smp():
	return map(str, inp().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(m, val) for j in range(n)]

def remadd(x, y):
	return 1 if x % y else 0

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

def isprime(x):
	if x <= 1:
		return False
	if x in (2, 3):
		return True
	if x % 2 == 0:
		return False
	for i in range(3, int(sqrt(x)) + 1, 2):
		if x % i == 0:
			return False
	return True
(n, m, x, y) = mp()
i = 0
for i in range(x, n + 1):
	print(i, y)
for i in range(x - 1, 0, -1):
	print(i, y)
for i in range(y + 1, m + 1):
	if not (y - i) % 2 ^ (x == 1):
		for j in range(n, 0, -1):
			print(j, i)
	else:
		for j in range(1, n + 1):
			print(j, i)
for i in range(y - 1, 0, -1):
	if ((m - y) % 2 and (y - i) % 2 or ((m - y) % 2 == 0 and (y - i) % 2 == 0)) and x != 1:
		for j in range(n, 0, -1):
			print(j, i)
	else:
		for j in range(1, n + 1):
			print(j, i)


(n, m, s_x, s_y) = map(int, input().split())
ans = [[s_x, s_y]]
for c in range(s_y + 1, m + 1):
	ans.append([s_x, c])
for c in range(s_y - 1, 0, -1):
	ans.append([s_x, c])
start = 1
for r in range(s_x + 1, n + 1):
	if start:
		for c in range(1, m + 1):
			ans.append([r, c])
		start = 0
	else:
		for c in range(m, 0, -1):
			ans.append([r, c])
		start = 1
for r in range(s_x - 1, 0, -1):
	if start:
		for c in range(1, m + 1):
			ans.append([r, c])
		start = 0
	else:
		for c in range(m, 0, -1):
			ans.append([r, c])
		start = 1
for i in ans:
	print(*i)


import math
import sys
import itertools
import random
import bisect
import heapq
import collections

def lcm(x, y):
	return x * y // math.gcd(x, y)

def hcf(x, y):
	return math.gcd(x, y)

def primes(n):
	prime = [True for _ in range(0, n + 1)]
	res = []
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[p] = False
		p += 1
	for i in range(0, n + 1):
		if prime[i] == True:
			res.append(i)
	return res

def primeFactors(n):
	res = []
	while n % 2 == 0:
		res.append(2)
		n //= 2
	for i in range(3, math.sqrt(n) + 1, 2):
		while n % i == 0:
			res.append(i)
			n //= i
	if n > 2:
		res.append(n)
	return res
(n, m, xs, ys) = map(int, input().strip().split())
x = xs
y = ys
res = []
res.append([x, y])
sy = y
flag = 0
for i in range(y - 1, 0, -1):
	res.append([x, i])
y = sy
for i in range(y + 1, m + 1):
	res.append([x, i])
y = i
for i in range(xs - 1, 0, -1):
	if flag == 0:
		flag = 1
		for j in range(m, 0, -1):
			res.append([i, j])
	else:
		flag = 0
		for j in range(1, m + 1):
			res.append([i, j])
for i in range(xs + 1, n + 1):
	if flag == 0:
		flag = 1
		for j in range(m, 0, -1):
			res.append([i, j])
	else:
		flag = 0
		for j in range(1, m + 1):
			res.append([i, j])
for i in res:
	print(*i)


(n, m, x, y) = [int(x1) for x1 in input().split()]
y1 = y
x1 = x
print(x, y)
while y > 1:
	y = y - 1
	print(x, y)
y = y1
while y < m:
	y = y + 1
	print(x, y)
c = 0
while x < n:
	x = x + 1
	if c % 2 == 0:
		while y >= 1:
			print(x, y)
			y = y - 1
		y = 1
		c = 1
	else:
		while y <= m:
			print(x, y)
			y += 1
		y = m
		c = 0
x = 1
c = 0
z = y
if z == 1:
	while x < x1:
		if c == 0:
			while y <= m:
				print(x, y)
				y += 1
			c = 1
			y = m
		else:
			while y >= 1:
				print(x, y)
				y -= 1
			c = 0
			y = 1
		x = x + 1
	c = 0
elif z == m:
	while x < x1:
		if c == 0:
			while y >= 1:
				print(x, y)
				y -= 1
			c = 1
			y = 1
		else:
			while y <= m:
				print(x, y)
				y += 1
			c = 0
			y = m
		x = x + 1


import math
from decimal import Decimal
import heapq
import copy
import heapq
from collections import deque
from collections import defaultdict
MOD = 1000000007

def na():
	n = int(input())
	b = [int(x) for x in input().split()]
	return (n, b)

def nab():
	n = int(input())
	b = [int(x) for x in input().split()]
	c = [int(x) for x in input().split()]
	return (n, b, c)

def dv():
	(n, m) = map(int, input().split())
	return (n, m)

def da():
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	return (n, m, a)

def dva():
	(n, m) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	return (n, m, b)

def eratosthenes(n):
	sieve = list(range(n + 1))
	for i in sieve:
		if i > 1:
			for j in range(i + i, len(sieve), i):
				sieve[j] = 0
	return sorted(set(sieve))

def lol(lst, k):
	k = k % len(lst)
	ret = [0] * len(lst)
	for i in range(len(lst)):
		if i + k < len(lst) and i + k >= 0:
			ret[i] = lst[i + k]
		if i + k >= len(lst):
			ret[i] = lst[i + k - len(lst)]
		if i + k < 0:
			ret[i] = lst[i + k + len(lst)]
	return ret

def nm():
	n = int(input())
	b = [int(x) for x in input().split()]
	m = int(input())
	c = [int(x) for x in input().split()]
	return (n, b, m, c)

def dvs():
	n = int(input())
	m = int(input())
	return (n, m)

def fact(n):
	tc = []
	ans = {}
	d = 2
	while d * d <= n:
		if n % d == 0:
			tc.append(d)
			n //= d
		else:
			d += 1
	if n > 1:
		tc.append(n)
	for i in tc:
		ans[i] = ans.get(i, 0) + 1
	return ans

def to_zero(n, s):
	lst = s[0]
	ans = []
	for i in range(n):
		if lst == s[i]:
			continue
		elif lst == '0':
			lst = '1'
			ans.append(i)
		else:
			lst = '0'
			ans.append(i)
	if lst == '1':
		ans.append(n)
	return ans
(n, m, sx, sy) = map(int, input().split())
print(sx, sy)
if sy != m:
	for i in range(1, m + 1):
		if i != sy:
			print(sx, i)
	x = 1
	y = m
	while x <= n:
		if x == sx:
			x += 1
			continue
		if y == m:
			for i in range(m, 0, -1):
				print(x, i)
				y = i
		else:
			for i in range(1, m + 1):
				print(x, i)
				y = i
		x += 1
else:
	for i in range(m, 0, -1):
		print(sx, i)
	x = 1
	y = m
	while x <= n:
		if x == sx:
			x += 1
			continue
		if y == m:
			for i in range(m, 0, -1):
				print(x, i)
				y = i
		else:
			for i in range(1, m + 1):
				print(x, i)
				y = i
		x += 1


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


import sys, math
import io, os
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

def data():
	return sys.stdin.readline().strip()

def mdata():
	return list(map(int, data().split()))

def outl(var):
	sys.stdout.write('\n'.join(map(str, var)) + '\n')

def out(var):
	sys.stdout.write(str(var) + '\n')
from decimal import Decimal
from fractions import Fraction
INF = float('inf')
mod = int(1000000000.0) + 7
(n, m, x, y) = mdata()
cnt = 0
print(x, y)
for i in range(m):
	if y == i + 1:
		continue
	print(x, i + 1)
k = -1
for i in range(n):
	if i + 1 == x:
		continue
	for j in range(m):
		if k == -1:
			print(i + 1, m - j)
		else:
			print(i + 1, j + 1)
	k *= -1


(n, m, x, y) = input().split()
n = int(n)
m = int(m)
x = int(x)
y = int(y)
print(x, y)
for s in range(1, m + 1):
	if s != y:
		print(x, s)
j = 1
v = 1
while j < n + 1:
	if j != x:
		v += 1
		i = 1
		while i < m + 1:
			if v % 2 != 0:
				print(j, i)
			elif v % 2 == 0:
				print(j, m + 1 - i)
			i += 1
	j += 1


(n, m, x, y) = list(map(int, input().split()))
vis = [[False for i in range(m)] for j in range(n)]
x -= 1
y -= 1
ans = []
while x != 0:
	if vis[x][y] == False:
		vis[x][y] = True
		ans.append([x + 1, y + 1])
	x -= 1
while y != 0:
	if vis[x][y] == False:
		vis[x][y] = True
		ans.append([x + 1, y + 1])
	y -= 1
for i in range(n):
	if i % 2 == 0:
		for j in range(m):
			if vis[i][j] == False:
				vis[i][j] = True
				ans.append([i + 1, j + 1])
	else:
		for j in range(m - 1, -1, -1):
			if vis[i][j] == False:
				vis[i][j] = True
				ans.append([i + 1, j + 1])
for i in ans:
	print(*i)


(n, m, s_x, s_y) = map(int, input().split())
print(s_x, s_y)
print(s_x, 1)
col = 1
for column in range(1, m + 1):
	if col == 1:
		for row in range(1, n + 1):
			if (row, column) != (s_x, s_y) and (row, column) != (s_x, 1):
				print(row, column)
		col = 2
	else:
		for row in range(n, 0, -1):
			if (row, column) != (s_x, s_y) and (row, column) != (s_x, 1):
				print(row, column)
		col = 1


import sys
input = sys.stdin.readline
(n, m, x, y) = list(map(int, input().split()))
V = {}
x -= 1
y -= 1
for i in range(x, x + n):
	for j in range(m):
		if j != 0:
			y += 1
		a = i % n + 1
		b = y % m + 1
		if (a, b) not in V:
			print(a, b)
			V[a, b] = 1


for _ in range(1):
	(n, m, x, y) = map(int, input().split())
	print(x, y, sep=' ')
	for i in range(m):
		if i + 1 != y:
			print(x, i + 1, sep=' ')
		if i == m - 1:
			c = i
	for i in range(n):
		if i + 1 != x:
			if c == 0:
				for j in range(m):
					print(i + 1, j + 1, sep=' ')
				c = m - 1
			else:
				for j in range(m, 0, -1):
					print(i + 1, j, sep=' ')
				c = 0


(n, m, a, b) = map(int, input().split())
print(a, b)
for i in range(m):
	if not i == b - 1:
		print(a, i + 1)
temp = True
i = a - 2
while i >= 0:
	if temp:
		for j in range(m - 1, -1, -1):
			print(i + 1, j + 1)
		temp = False
	else:
		for j in range(m):
			print(i + 1, j + 1)
		temp = True
	i -= 1
i = a
while i < n:
	if temp:
		for j in range(m - 1, -1, -1):
			print(i + 1, j + 1)
		temp = False
	else:
		for j in range(m):
			print(i + 1, j + 1)
		temp = True
	i += 1


from collections import Counter
import string
import math
import sys

def array_int():
	return [int(i) for i in sys.stdin.readline().split()]

def vary(arrber_of_variables):
	if arrber_of_variables == 1:
		return int(sys.stdin.readline())
	if arrber_of_variables >= 2:
		return map(int, sys.stdin.readline().split())

def makedict(var):
	return dict(Counter(var))
mod = 1000000007
(n, m, x, y) = vary(4)
arr = []
s = set()
s.add((x, y))
print(x, y)
print(1, y)
s.add((1, y))
print(1, 1)
s.add((1, 1))
for i in range(1, n + 1):
	if i % 2 != 0:
		for j in range(1, m + 1):
			if (i, j) not in s:
				print(i, j)
				s.add((i, j))
	else:
		for j in range(m, 0, -1):
			if (i, j) not in s:
				print(i, j)
				s.add((i, j))


(n, m, Sx, Sy) = map(int, input().split())
print(Sx, Sy)
flag = False
for i in range(1, Sx):
	print(i, Sy)
for i in range(Sx + 1, n + 1):
	print(i, Sy)
for i in range(1, Sy):
	if flag:
		for j in range(1, n + 1):
			print(j, i)
		flag = False
	else:
		for j in range(n, 0, -1):
			print(j, i)
		flag = True
for i in range(Sy + 1, m + 1):
	if flag:
		for j in range(1, n + 1):
			print(j, i)
		flag = False
	else:
		for j in range(n, 0, -1):
			print(j, i)
		flag = True


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
inin = lambda : int(input())
inar = lambda : list(map(int, input().split()))
inst = lambda : input().decode().rstrip('\n\r')
INF = float('inf')
_T_ = 1
for _t_ in range(_T_):
	(n, m, x, y) = inar()
	cx = x
	print(x, y)
	move = 1
	for j in range(y - 1, 0, -1):
		print(x, j)
	for j in range(y + 1, m + 1):
		print(x, j)
	while x < n:
		move = -move
		x += 1
		if move == -1:
			for j in range(m, 0, -1):
				print(x, j)
		if move == 1:
			for j in range(1, m + 1):
				print(x, j)
	x = 0
	while x < cx - 1:
		move = -move
		x += 1
		if move == -1:
			for j in range(m, 0, -1):
				print(x, j)
		if move == 1:
			for j in range(1, m + 1):
				print(x, j)


(n, m, x, y) = list(map(int, input().split()))
print(f'{x} {y}')
for i in range(1, n + 1):
	if i != x:
		print(f'{i} {y}')
start = [n, 1]
end = [0, n + 1]
inc = [-1, 1]
idx = 0
for j in range(1, m + 1):
	if j != y:
		for i in range(start[idx], end[idx], inc[idx]):
			print(f'{i} {j}')
		if idx == 0:
			idx = 1
		else:
			idx = 0


A = [int(i) for i in input().split()]
n = A[0]
m = A[1]
x = A[2]
y = A[3]
a = x
b = y
while y <= m:
	print(x, y)
	y += 1
y = b - 1
while y >= 1:
	print(x, y)
	y -= 1
t = 0
for i in range(n):
	if i + 1 != a and t == 0:
		for j in range(m):
			print(i + 1, j + 1)
		t = 1
	elif i + 1 != a and t == 1:
		for j in range(m):
			print(i + 1, m - j)
		t = 0


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())

def print_list(l):
	print(' '.join(map(str, l)))
(n, m, sx, sy) = RL()
print(sx, sy)
for j in range(1, sy):
	print(sx, j)
for j in range(sy + 1, m + 1):
	print(sx, j)
flag = False
for i in range(1, sx):
	if flag:
		for j in range(1, m + 1):
			print(i, j)
	else:
		for j in range(m, 0, -1):
			print(i, j)
	flag = not flag
for i in range(sx + 1, n + 1):
	if flag:
		for j in range(1, m + 1):
			print(i, j)
	else:
		for j in range(m, 0, -1):
			print(i, j)
	flag = not flag


(n, m, x, y) = list(map(int, input().split()))
for j in range(y, m + 1):
	print(x, j)
for j in range(y - 1, 0, -1):
	print(x, j)
direction = 'r'
for i in range(x + 1, n + 1):
	if direction == 'r':
		for j in range(1, m + 1):
			print(i, j)
		direction = 'l'
	else:
		for j in range(m, 0, -1):
			print(i, j)
		direction = 'r'
for i in range(1, x):
	if direction == 'r':
		for j in range(1, m + 1):
			print(i, j)
		direction = 'l'
	else:
		for j in range(m, 0, -1):
			print(i, j)
		direction = 'r'


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


(n, m, Sx, Sy) = map(int, input().split())
i = Sx - 1
j = Sy - 1
c = 0
while c < n:
	cc = 0
	while cc < m:
		print(i + 1, j + 1)
		cc += 1
		j = (j + 1) % m
	c += 1
	i = (i + 1) % n
	j = (j - 1) % m


import sys
(n, m, x, y) = map(int, input().split(' '))
chess = [[0 for _ in range(m + 2)] for _ in range(n + 2)]
for i in range(n):
	for j in range(m):
		chess[x][y] = 1
		print(x, y)
		(x_, y_) = (x, y + 1)
		if y_ > m or chess[x][y_] == 1:
			y_ = 1
			if chess[x][y_] == 1:
				x_ = x - 1
				y_ = y
				if x_ < 1:
					x_ = n
		(x, y) = (x_, y_)


def my_range(s1, s2, f1, f2):
	if s1 > f1:
		for i in range(s1, f1 - 1, -1):
			ans.append((i, s2))
	else:
		for i in range(s1, f1 + 1):
			ans.append((i, s2))
ans = []
(n, m, s1, s2) = map(int, input().split())
my_range(s1, s2, 1, s2)
my_range(s1 + 1, s2, n, s2)
(x_start, y_start) = (n, s2 + 1)
flag = 1
while y_start <= m:
	if flag == 1:
		my_range(x_start, y_start, 1, y_start)
		x_start = 1
	else:
		my_range(x_start, y_start, n, y_start)
		x_start = n
	y_start += 1
	flag *= -1
y_start = s2 - 1
while y_start > 0:
	if flag == 1:
		my_range(x_start, y_start, 1, y_start)
		x_start = 1
	else:
		my_range(x_start, y_start, n, y_start)
		x_start = n
	y_start -= 1
	flag *= -1
for i in ans:
	print(*i)


import math, sys
from sys import stdin, stdout
from collections import Counter, defaultdict, deque
input = stdin.readline
I = lambda : int(input())
li = lambda : list(map(int, input().split()))

def solve():
	(n, m, p, q) = li()
	ans = []
	ans.append((p, q))
	f = 1
	(s, t) = (p, 1)
	for i in range(m):
		if (s, t) != (p, q):
			ans.append((s, t))
		t += 1
	f = 1
	s = p
	for i in range(n - p):
		if f:
			(s, t) = (s + 1, m)
			for j in range(m):
				ans.append((s, t))
				t -= 1
			f = 0
		else:
			(s, t) = (s + 1, 1)
			for j in range(m):
				ans.append((s, t))
				t += 1
			f = 1
	s = 0
	for i in range(p - 1):
		if f:
			(s, t) = (s + 1, m)
			for j in range(m):
				ans.append((s, t))
				t -= 1
			f = 0
		else:
			(s, t) = (s + 1, 1)
			for j in range(m):
				ans.append((s, t))
				t += 1
			f = 1
	for i in ans:
		print(*i)
for _ in range(1):
	solve()


import sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
(n, m, x, y) = I()
an = [0] * (n * m)
an = []
for i in range(n):
	an.append([x, y])
	y += 1
	if y > m:
		y = 1
	for i in range(1, m):
		an.append([x, y])
		if y == m:
			y = 0
		y += 1
	x += 1
	y -= 1
	if y == 0:
		y = m
	if x == n + 1:
		x = 1
for i in range(n * m):
	print(*an[i])


(n, m, x, y) = map(int, input().split())
(x, y) = (x - 1, y - 1)
i = 1
for line in range(1, n + 1):
	for col in range(1, m + 1):
		print(x + 1, y + 1)
		i += 1
		y = (y - 1) % m
	x = (x + 1) % n
	y = (y + 1) % m


(n, m, sx, sy) = map(int, input().split())
print(sx, sy)
for i in range(sy + 1, m + 1):
	print(sx, i)
for i in range(sy - 1, 0, -1):
	print(sx, i)
flag = 0
for i in range(1, n + 1):
	if i == sx:
		continue
	if flag == 0:
		for j in range(1, m + 1):
			print(i, j)
		flag = 1
	else:
		for j in range(m, 0, -1):
			print(i, j)
		flag = 0


(n, m, sx, sy) = map(int, input().split())
visited = set()
visited.add((sx, sy))
print(sx, sy)
visited.add((1, sy))
print(1, sy)
for i in range(1, n + 1):
	if i % 2 != 0:
		for j in range(m, 0, -1):
			if (i, j) not in visited:
				visited.add((i, j))
				print(i, j)
	else:
		for j in range(1, m + 1):
			if (i, j) not in visited:
				visited.add((i, j))
				print(i, j)


import sys

def mover(r, c, n, m):
	l1 = c
	countr = 0
	countl = 0
	while l1 >= 1:
		countr = 1
		print('{} {}'.format(r, l1))
		l1 -= 1
	l1 = c + 1
	while l1 <= m:
		countl = 1
		print('{} {}'.format(r, l1))
		l1 += 1
	if countl == 0:
		return 1
	else:
		return m
(n, m, s1, s2) = map(int, sys.stdin.readline().split())
k = s1
p = s2
counter = 0
while k >= 1:
	p = mover(k, p, n, m)
	k -= 1
k = s1 + 1
while k <= n:
	p = mover(k, p, n, m)
	k += 1


(n, m, x, y) = [int(__) for __ in input().split()]
l1 = list(range(1, n + 1))
l2 = list(range(1, m + 1))
print(x, y)
for i in l1[x:]:
	print(i, y)
for i in l1[:x - 1][::-1]:
	print(i, y)
for i in l2[y:]:
	for j in l1:
		print(j, i)
	l1.reverse()
for i in l2[:y - 1][::-1]:
	for j in l1:
		print(j, i)
	l1.reverse()


(n, m, s1, s2) = map(int, input().split())
q = []
q2 = [s2]
fi = list(range(1, m + 1))[::-1]
for i in range(1, n + 1):
	if i != s1:
		q.append(i)
for i in range(1, m + 1):
	if i != s2:
		q2.append(i)
i = s1
for item in q2:
	print(i, item)
for i in q:
	for j in fi:
		print(i, j)
	fi[:] = fi[::-1]


(n, m, x, y) = map(int, input().split(' '))
for i in range(y, m + 1):
	print(x, i)
i = y - 1
while i >= 1:
	print(x, i)
	i = i - 1
e = False
for i in range(1, m + 1):
	arr = []
	for j in range(1, n + 1):
		if j != x:
			arr.append([j, i])
	if e == False:
		for item in arr:
			print(item[0], item[1])
		e = True
	else:
		arr.reverse()
		for item in arr:
			print(item[0], item[1])
		e = False


(a, b, p, q) = map(int, input().split())
f = 0
c = 2
print(p, q)
for j in range(1, b + 1):
	if j != q:
		print(p, j)
	f = 2
for j in range(p + 1, a + 1):
	if f == 2:
		for k in range(b, 0, -1):
			print(j, k)
		f = 1
	else:
		for k in range(1, b + 1):
			print(j, k)
		f = 2
for j in range(1, p):
	if f == 2:
		for k in range(b, 0, -1):
			print(j, k)
		f = 1
	else:
		for k in range(1, b + 1):
			print(j, k)
		f = 2


(n, m, sx, sy) = map(int, input().split())
grid = [[False] * m for i in range(n)]
sx -= 1
sy -= 1
print(sx + 1, sy + 1)
grid[sx][sy] = True
print(1, sy + 1)
grid[0][sy] = True
for i in range(n):
	if i == 0:
		for j in range(sy - 1, -1, -1):
			print(i + 1, j + 1)
			grid[i][j] = True
		for j in range(sy + 1, m):
			print(i + 1, j + 1)
			grid[i][j] = True
	elif i % 2 == 0:
		for j in range(m):
			if grid[i][j] == False:
				print(i + 1, j + 1)
				grid[i][j] = True
	else:
		for j in range(m - 1, -1, -1):
			if grid[i][j] == False:
				print(i + 1, j + 1)
				grid[i][j] = True


(n, m, sx, sy) = map(int, input().strip().split())

def visitLine(reverse, x):
	if not reverse:
		for i in range(m):
			print(x, i + 1)
	else:
		for i in range(m, 0, -1):
			print(x, i)
print(sx, sy)
for i in range(m, 0, -1):
	if i != sy:
		print(sx, i)
reverse = False
for i in range(1, n + 1):
	if i == sx:
		continue
	else:
		visitLine(reverse, i)
		if reverse:
			reverse = False
		else:
			reverse = True


(n, m, Sx, Sy) = map(int, input().split())
print(Sx, Sy)
print(Sx, 1)
j = 1
k = 1
while j <= n and k <= m:
	if k % 2 == 1:
		if j == Sx and k == Sy or (j == Sx and k == 1):
			j += 1
		elif j == n and k == m:
			print(j, k)
			break
		elif j == n:
			print(j, k)
			k += 1
		else:
			print(j, k)
			j += 1
	elif j == Sx and k == Sy or (j == Sx and k == 1):
		j -= 1
	elif j == 1 and k == m:
		print(j, k)
		break
	elif j == 1:
		print(j, k)
		k += 1
	else:
		print(j, k)
		j -= 1


(n, m, x, y) = [int(k) for k in input().split(' ')]
ans = []

def get_column(n, m, xi, yi):
	if xi == 1:
		last_x = xi + 1
	else:
		last_x = xi - 1
	ans.append((xi, yi))
	for p in range(1, n + 1):
		if p == last_x or p == xi:
			continue
		ans.append((p, yi))
	ans.append((last_x, yi))
(xi, yi) = (x, y)
for q in range(y, 0, -1):
	yi = q
	get_column(n, m, xi, yi)
	(xi, yi) = ans[-1]
for q in range(y + 1, m + 1):
	yi = q
	get_column(n, m, xi, yi)
	(xi, yi) = ans[-1]
for a in ans:
	print(str(a[0]) + ' ' + str(a[1]))


import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
ns = lambda : readline().rstrip()
ni = lambda : int(readline().rstrip())
nm = lambda : map(int, readline().split())
nl = lambda : list(map(int, readline().split()))
(n, m, x, y) = nm()
print(x, y)
for i in range(1, m + 1):
	if i != y:
		print(x, i)
pre = 1
for i in range(1, n + 1):
	if i != x:
		pre += 1
		if pre & 1:
			for j in range(1, m + 1):
				print(i, j)
		else:
			for j in range(m, 0, -1):
				print(i, j)


(n, m, ns, ms) = map(int, input().split(' '))
print(f'{ns} {ms}')
print(f'1 {ms}')
for i in range(1, n + 1):
	for j in range(1, m + 1):
		(x, y) = (i, j) if i % 2 else (i, m - j + 1)
		if (x, y) != (ns, ms) and (x, y) != (1, ms):
			print(f'{x} {y}')


(n, m, x, y) = list(map(int, input().split()))
print(x, y)
for i in range(y + 1, m + 1):
	print(x, i)
for i in range(y - 1, 0, -1):
	print(x, i)
move_right = True
for i in range(1, n + 1):
	if i == x:
		continue
	if move_right:
		for j in range(1, m + 1):
			print(i, j)
	else:
		for j in range(m, 0, -1):
			print(i, j)
	move_right = not move_right


for _ in range(1):
	(n, m, x, y) = map(int, input().split())
	ans = []
	for i in range(x, n + 1):
		ans.append([i, y])
	for i in range(x - 1, 0, -1):
		ans.append([i, y])
	prv = 0
	for j in range(1, y):
		if j % 2 == 1:
			for i in range(1, n + 1):
				ans.append([i, j])
			prv = 1
		else:
			for i in range(n, 0, -1):
				ans.append([i, j])
			prv = 0
	for j in range(y + 1, m + 1):
		if prv == 0:
			for i in range(1, n + 1):
				ans.append([i, j])
			prv = 1
		else:
			for i in range(n, 0, -1):
				ans.append([i, j])
			prv = 0
	for i in range(n * m):
		print(ans[i][0], ans[i][1])


(a, b, c, d) = map(int, input().split())
l = []
for i in range(d, b + 1):
	print(c, i)
for i in range(d - 1, 0, -1):
	print(c, i)
flag = True
for i in range(1, b + 1):
	if flag:
		for j in range(c + 1, a + 1):
			print(j, i)
		flag = False
	else:
		for j in range(a, c, -1):
			print(j, i)
		flag = True
flag = True
for i in range(b, 0, -1):
	if flag:
		for j in range(c - 1, 0, -1):
			print(j, i)
		flag = False
	else:
		for j in range(1, c):
			print(j, i)
		flag = True


def func(sx, sy):
	jxxx = 0
	troy = 1
	lsty = [1, 2, 3, 4, 5]
	flagy = False
	ny = sy
	for i in range(1, m + 1):
		if v[sx][i] == 0:
			v[sx][i] = 1
			print(sx, i)
			ny = i
			flagy = True
	if sx != n:
		if v[sx + 1][ny] == 0:
			v[sx + 1][ny] = 1
			flagy = False
			print(sx + 1, ny)
			func(sx + 1, ny)
		elif v[sx + 1][ny] == 1:
			v[sx + 2][ny] = 1
			print(sx + 2, ny)
			func(sx + 2, ny)
			v[sx + 1][m] = 1
			print(sx + 1, m)
			for i in range(1, m + 1):
				if v[sx + 1][i] == 0:
					v[sx + 1][i] = 1
					flagy = True
					print(sx + 1, i)
	else:
		return
(n, m, sx, sy) = map(int, input().split())
v = [[0 for i in range(m + 1)] for i in range(n + 1)]
booli = False
vct = [1, 2, 3, 4, 5, 6, 7, 8, 9]
i = 0
i += 1
v[sx][sy] = 1
print(sx, sy)
sy = 1
v[sx][sy] = 1
print(sx, sy)
sx = 1
v[sx][sy] = 1
print(sx, sy)
func(sx, sy)


import sys
(n, m, x_start, y_start) = (int(i) for i in input().split())
print(x_start, y_start)
for y in range(1, m + 1):
	if y != y_start:
		print(x_start, y)
cur = 1
for x in range(1, n + 1):
	if x != x_start:
		if cur == 1:
			for y in range(0, m):
				print(x, m - y)
		else:
			for y in range(1, m + 1):
				print(x, y)
		cur = 1 - cur


(n, m, x, y) = map(int, input().split())
last = -1
print(x, y)
for i in range(1, m + 1):
	if i == y:
		continue
	print(x, i)
	last = i
for i in range(1, n + 1):
	if i == x:
		continue
	print(i, last)
	a = -1
	for j in range(1, m + 1):
		if j == last:
			continue
		print(i, j)
		a = j
	last = a


(n, m, x, y) = map(int, input().split())
l = [[0 for i in range(m)] for j in range(n)]
l[x - 1][y - 1] = 1
a = x - 1
b = y - 1
print(a + 1, b + 1)
c = 1
while c < m * n:
	t = 0
	for i in range(m):
		if l[a][i] == 0:
			print(a + 1, i + 1)
			l[a][i] = 1
			c += 1
			t = i
	b = t
	for i in range(n):
		if l[i][b] == 0:
			print(i + 1, b + 1)
			l[i][b] = 1
			c += 1
			t = i
	a = t


import sys, os
from io import BytesIO, IOBase
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(stdin, stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
mod = pow(10, 9) + 7
mod2 = 998244353

def inp():
	return stdin.readline().strip()

def iinp():
	return int(inp())

def out(var, end='\n'):
	stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	stdout.write(' '.join(map(str, var)) + end)

def lmp():
	return list(mp())

def mp():
	return map(int, inp().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(m, val) for j in range(n)]

def ceil(a, b):
	return (a + b - 1) // b
S1 = 'abcdefghijklmnopqrstuvwxyz'
S2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

def isprime(x):
	if x <= 1:
		return False
	if x in (2, 3):
		return True
	if x % 2 == 0:
		return False
	for i in range(3, int(sqrt(x)) + 1, 2):
		if x % i == 0:
			return False
	return True
(n, m, sy, sx) = mp()
ans = []
ans.append([sy, sx])
rest = []
for j in range(1, m + 1):
	if j != sx:
		rest.append([sy, j])
ans.extend(rest)
reverse = True
for i in range(n):
	if i + 1 != sy:
		row = [(i + 1, j) for j in range(1, m + 1)]
		if reverse:
			row.reverse()
		ans.extend(row)
		reverse = not reverse
for (i, j) in ans:
	print(i, j)


import sys
import os
import math
import copy
from math import gcd
from bisect import bisect
from io import BytesIO, IOBase
from math import sqrt, floor, factorial, gcd, log, ceil
from collections import deque, Counter, defaultdict
from itertools import permutations, combinations
from itertools import accumulate

def Int():
	return int(sys.stdin.readline())

def Mint():
	return map(int, sys.stdin.readline().split())

def Lstr():
	return list(sys.stdin.readline().strip())

def Str():
	return sys.stdin.readline().strip()

def Mstr():
	return map(str, sys.stdin.readline().strip().split())

def List():
	return list(map(int, sys.stdin.readline().split()))

def Hash():
	return dict()

def Mod():
	return 1000000007

def Ncr(n, r, p):
	return fact[n] * (ifact[r] * ifact[n - r] % p) % p

def Most_frequent(list):
	return max(set(list), key=list.count)

def Mat2x2(n):
	return [List() for _ in range(n)]

def Lcm(x, y):
	return x * y // gcd(x, y)

def dtob(n):
	return bin(n).replace('0b', '')

def btod(n):
	return int(n, 2)

def common(l1, l2):
	return set(l1).intersection(l2)

def solution():
	(n, m, s, e) = Mint()
	for i in range(n):
		for j in range(m):
			print(s, e)
			if j != m - 1:
				e = e % m + 1
		s = s % n + 1
solution()


def gns():
	return list(map(int, input().split()))
(n, m, x, y) = gns()
print(x, y)
print(1, y)
print(1, 1)
for i in range(1, n + 1):
	r = range(1, m + 1)
	if i % 2 == 0:
		r = reversed(r)
	for j in r:
		if (i, j) == (1, y) or (i, j) == (x, y) or (i, j) == (1, 1):
			continue
		print(i, j)


(n, m, x, y) = map(int, input().split())
result = [(x, y)]
for j in range(1, m + 1):
	if j == y:
		continue
	result.append((x, j))
for i in range(1, n + 1):
	if i == x:
		continue
	last = result[-1][1]
	result.append((i, last))
	for j in range(1, m + 1):
		if j == last:
			continue
		result.append((i, j))
for t in result:
	print(t[0], t[1])


(n, m, x1, y1) = map(int, input().split())
print(x1, y1)
set1 = set()
set1.add((x1, y1))
for i in range(x1 - 1, n):
	if i % 2 == 0:
		for j in range(m):
			if (i + 1, j + 1) not in set1:
				print(i + 1, j + 1)
				set1.add((i + 1, j + 1))
				last = j + 1
	else:
		for j in range(m, 0, -1):
			if (i + 1, j) not in set1:
				print(i + 1, j)
				set1.add((i + 1, j))
				last = j
for i in range(x1):
	if last == 1:
		for j in range(m):
			if (i + 1, j + 1) not in set1:
				print(i + 1, j + 1)
				set1.add((i + 1, j + 1))
				last = j + 1
	else:
		for j in range(m, 0, -1):
			if (i + 1, j) not in set1:
				print(i + 1, j)
				set1.add((i + 1, j))
				last = j


def find_index_h(i, j):
	for k in range(n):
		if chess[k][j] == 's':
			return k
	return -1

def find_index_v(i, j):
	for k in range(m):
		if chess[i][k] == 's':
			return k
	return -1
[n, m, i, j] = list(map(int, input().split()))
chess = ['s'] * n
for c in range(n):
	chess[c] = ['s'] * m
chess[i - 1][j - 1] = 1
count = 1
if i >= 2 and i <= n - 1 and (j >= 2) and (j <= m - 1):
	print(str(i) + ' ' + str(j))
	i -= 1
	j -= 1
	while count != m * n:
		if i + 1 <= n - 1 and chess[i][j] == 's':
			i += 1
			chess[i][j] = 1
			count += 1
			print(str(i + 1) + ' ' + str(j + 1))
		elif find_index_h(i, j) != -1:
			i = find_index_h(i, j)
			chess[i][j] = 1
			count += 1
			print(str(i + 1) + ' ' + str(j + 1))
		elif j + 1 <= m - 1 and chess[i][j] == 's':
			j += 1
			chess[i][j] = 1
			count += 1
			print(str(i + 1) + ' ' + str(j + 1))
		elif find_index_v(i, j) != -1:
			j = find_index_v(i, j)
			chess[i][j] = 1
			count += 1
			print(str(i + 1) + ' ' + str(j + 1))


import sys
input = sys.stdin.readline
ins = lambda : input().rstrip()
ini = lambda : int(input().rstrip())
inm = lambda : map(int, input().split())
inl = lambda : list(map(int, input().split()))
(n, m, x, y) = inm()
xs = x
ys = y
up = False
right = False
for i in range(m):
	for i in range(n):
		print(x, y)
		if x > 1 and up == False:
			x -= 1
		elif x == 1:
			if i != 0:
				x = 0
			up = True
			if y == ys:
				x += xs
		if x < n and up == True:
			x += 1
		elif x == n:
			if i != 0:
				x = n
			up = False
	if y > 1 and right == False:
		y -= 1
	elif y == 1 and right == False:
		right = True
		y += ys
	else:
		y += 1


import sys
input = sys.stdin.readline
(n, m, sx, sy) = map(int, input().split())
ans = [[0] * m for _ in range(n)]
ans[sx - 1][sy - 1] = 1
print(sx, sy)
now = 2
if sy == m:
	rev = True
else:
	rev = False
if not rev:
	for i in range(m):
		if ans[sx - 1][i] == 0:
			ans[sx - 1][i] = now
			print(sx, i + 1)
			now += 1
	rev = True
else:
	for i in range(m - 1, -1, -1):
		if ans[sx - 1][i] == 0:
			ans[sx - 1][i] = now
			print(sx, i + 1)
			now += 1
	rev = False
for i in range(n):
	if ans[i][0] == 0:
		if not rev:
			for j in range(m):
				ans[i][j] = now
				print(i + 1, j + 1)
				now += 1
			rev = True
		else:
			for j in range(m - 1, -1, -1):
				ans[i][j] = now
				print(i + 1, j + 1)
				now += 1
			rev = False


a = list(map(int, input().split()))
n = a[0]
m = a[1]
Sx = a[2]
Sy = a[3]
z = Sx + 1
w = Sy + 1
while Sx >= 1:
	print(Sx, Sy)
	Sx -= 1
Sx = z
while Sx <= n:
	print(Sx, Sy)
	if Sx == n:
		break
	Sx += 1
Sy -= 1
while Sy >= 1:
	if Sx == n:
		while Sx >= 1:
			print(Sx, Sy)
			if Sx == 1:
				break
			Sx -= 1
	else:
		while Sx <= n:
			print(Sx, Sy)
			if Sx == n:
				break
			Sx += 1
	if Sy == 1:
		break
	Sy -= 1
Sy = w
while Sy <= m:
	if Sx == n:
		while Sx >= 1:
			print(Sx, Sy)
			if Sx == 1:
				break
			Sx -= 1
	else:
		while Sx <= n:
			print(Sx, Sy)
			if Sx == n:
				break
			Sx += 1
	Sy += 1


def is_corner(i, j):
	if i == 1 and j == 1:
		return True
	if i == 1 and j == m:
		return True
	if i == n and j == 1:
		return True
	if i == n and j == m:
		return True
	return False
global n, m, x, y
(n, m, x, y) = map(int, input().split())
res = []
res.append([x, y])
(px, py) = (x, y)
while True:
	py -= 1
	res.append([px, py])
	if py == 1:
		break
(px, py) = (x, y)
while True:
	py += 1
	res.append([px, py])
	if py == m:
		break
ur = x - 1
dr = n - x
px -= 1
for i in range(ur):
	if i % 2 == 0:
		for j in range(m):
			res.append([px, py])
			if j != m - 1:
				py -= 1
		px -= 1
	else:
		for j in range(m):
			res.append([px, py])
			if j != m - 1:
				py += 1
		px -= 1
if py == 1:
	px = x + 1
	py = 1
	for i in range(dr):
		if i % 2 != 0:
			for j in range(m):
				res.append([px, py])
				if j != m - 1:
					py -= 1
			px += 1
		else:
			for j in range(m):
				res.append([px, py])
				if j != m - 1:
					py += 1
			px += 1
else:
	px = x + 1
	py = m
	for i in range(dr):
		if i % 2 == 0:
			for j in range(m):
				res.append([px, py])
				if j != m - 1:
					py -= 1
			px += 1
		else:
			for j in range(m):
				res.append([px, py])
				if j != m - 1:
					py += 1
			px += 1
for rs in res:
	print(*rs)


(ab, bb, x, y) = map(int, input().split())
print(x, y)
for g in range(1, bb + 1):
	if g != y:
		print(x, g)
		m = True
		r = x
for p in range(1, ab + 1):
	if p != r:
		for z in range(1, bb + 1):
			if m == True:
				z = bb - z + 1
			print(p, z)
		if m == True:
			m = False
		else:
			m = True


(n, m, xi, yi) = map(int, input().split())
x0 = xi
y0 = yi
xi += 1
t = 0
c = n
ans = []
while x0 > 0:
	ans.append((x0, yi))
	x0 -= 1
while xi <= n:
	ans.append((xi, yi))
	xi += 1
y1 = y0 - 1
while y1 > 0:
	x1 = -1
	if t:
		x1 = 1
		while x1 <= n:
			ans.append((x1, y1))
			x1 += 1
	else:
		x1 = n
		while x1 > 0:
			ans.append((x1, y1))
			x1 -= 1
	y1 -= 1
	t ^= 1
y1 = y0 + 1
while y1 <= m:
	x1 = -1
	if t:
		x1 = 1
		while x1 <= n:
			ans.append((x1, y1))
			x1 += 1
	else:
		x1 = n
		while x1 > 0:
			ans.append((x1, y1))
			x1 -= 1
	y1 += 1
	t ^= 1
for (a, b) in ans:
	print(a, b)


(n, m, s1, s2) = map(int, input().split())
g = -1
for i in range(s2, 0, -1):
	print(s1, i)
	k = 1
for i in range(s2 + 1, m + 1):
	print(s1, i)
	k = 0
h1 = s1 + 1
while h1 <= n:
	if k == 0:
		for i in range(m, 0, -1):
			print(h1, i)
			g = i
		k = 1
		h1 += 1
	elif k == 1:
		for i in range(1, m + 1):
			print(h1, i)
			g = i
		k = 0
		h1 += 1
h2 = s1 - 1
if g == m:
	k = 0
else:
	k = 1
while h2 > 0:
	if k == 0:
		for i in range(m, 0, -1):
			print(h2, i)
		k = 1
		h2 -= 1
	elif k == 1:
		for i in range(1, m + 1):
			print(h2, i)
		k = 0
		h2 -= 1


(n, m, x, y) = map(int, input().split())
l = [[x, y]]
for i in range(y - 1, 0, -1):
	l.append([x, i])
for i in range(y + 1, m + 1, 1):
	l.append([x, i])
y = m
while x < n:
	x += 1
	if y == m:
		for i in range(m, 0, -1):
			l.append([x, i])
		y = 1
	else:
		for i in range(1, m + 1):
			l.append([x, i])
		y = m
x = 1
while x < l[0][0]:
	if y == m:
		for i in range(m, 0, -1):
			l.append([x, i])
		y = 1
	else:
		for i in range(1, m + 1):
			l.append([x, i])
		y = m
	x += 1
for i in l:
	print(*i)


(n, m, x, y) = map(int, input().split())
a = y
while True:
	while y >= 1:
		print(x, y)
		y -= 1
	a += 1
	while a <= m:
		print(x, a)
		a += 1
	k = 0
	l = x
	x -= 1
	l += 1
	while x >= 1:
		if k % 2 == 0:
			for i in range(m, 0, -1):
				print(x, i)
			k += 1
		else:
			for i in range(i, m + 1):
				print(x, i)
			k += 1
		x -= 1
	while l <= n:
		if k % 2 == 0:
			for i in range(m, 0, -1):
				print(l, i)
			k += 1
		else:
			for i in range(i, m + 1):
				print(l, i)
			k += 1
		l += 1
	break


(n, m, x, y) = map(int, input().split())
print(x, y)
x1 = 1
y1 = y
print(x1, y1)
k = 1
j = 1
for i in range(1, n + 1):
	while 0 < j < m + 1:
		if (i != x or j != y) and (i != x1 or j != y1):
			print(i, j)
		j = j + k
	k = -k
	j += k


import sys
input = sys.stdin.readline
from collections import deque
(m, n, x, y) = map(int, input().split())
count = 0
for i in range(n * m):
	x = x % (m + 1)
	y = y % (n + 1)
	if x == 0:
		x += 1
	if y == 0:
		y += 1
	print(x, y)
	x += 1
	count += 1
	if count == m:
		(count, y, x) = (0, y + 1, x - 1)


(n, m, sx, sy) = map(int, input().split())
xx = [i for i in range(1, n + 1)]
yy = [i for i in range(1, m + 1)]
del yy[sy - 1]
print(sx, sy)
for i in xx:
	if i != sx:
		print(i, sy)
for j in yy:
	xx.reverse()
	for i in xx:
		print(i, j)


(n, m, sx, sy) = map(int, input().split())
x = sx
y = sy
print(x, y)
for i in range(1, m + 1):
	if i != sy:
		print(x, i)
x -= 1
y = m
while x > 0:
	step = 1 if y == 1 else -1
	for i in range(1, m + 1):
		print(x, y)
		y += step
	x -= 1
	y = 1 if y < 1 else m
x = sx + 1
while x <= n:
	step = 1 if y == 1 else -1
	for i in range(1, m + 1):
		print(x, y)
		y += step
	x += 1
	y = 1 if y < 1 else m


(n, m, Sx, Sy) = map(int, input().split())
ans = [(Sx, Sy)]
for i in range(1, n + 1):
	if i != Sx:
		ans.append((i, Sy))
for i in range(1, m + 1):
	if i != Sy:
		px = ans[-1][0]
		ans.append((px, i))
		for j in range(1, n + 1):
			if j != px:
				ans.append((j, i))
for ans_i in ans:
	print(*ans_i)


(m, n, Sx, Sy) = map(int, input().split())
x = Sx
y = Sy
print(x, y)
while y <= n:
	F = Sx != 1 and Sx != m
	while x < m and (Sx == 1 or F):
		x += 1
		print(x, y)
	if F:
		x = Sx - 1
		print(x, y)
	while x > 1 and (Sx == m or F):
		x -= 1
		print(x, y)
	Sx = x
	if y == n:
		y = 1
	elif y == Sy - 1:
		break
	else:
		y += 1
	print(x, y)


import sys
import math, bisect
from collections import defaultdict
from itertools import groupby, accumulate
from heapq import heapify, heappop, heappush
from collections import deque, Counter, OrderedDict

def neo():
	return map(int, input().split())

def Neo():
	return list(map(int, input().split()))
(n, m, x, y) = neo()
print(x, y)
if y == m:
	i = m - 1
	while i > 0:
		print(x, i)
		i -= 1
	p = 1
	for i in range(x + 1, n + 1):
		A = []
		for j in range(1, m + 1):
			A.append((i, j))
		if p % 2 == 0:
			A = A[::-1]
		for k in A:
			print(k[0], k[1])
		p += 1
	x -= 1
	while x > 0:
		A = []
		for j in range(1, m + 1):
			A.append((x, j))
		if p % 2 == 0:
			A = A[::-1]
		for k in A:
			print(k[0], k[1])
		p += 1
		x -= 1
else:
	for i in range(1, m + 1):
		if i != y:
			print(x, i)
	p = 0
	for i in range(x + 1, n + 1):
		A = []
		for j in range(1, m + 1):
			A.append((i, j))
		if p % 2 == 0:
			A = A[::-1]
		for k in A:
			print(k[0], k[1])
		p += 1
	x -= 1
	while x > 0:
		A = []
		for j in range(1, m + 1):
			A.append((x, j))
		if p % 2 == 0:
			A = A[::-1]
		for k in A:
			print(k[0], k[1])
		p += 1
		x -= 1


temp = list(map(int, input().split()))
row = temp[0]
column = temp[1]
current = [temp[2], temp[3]]
stepped = [[False] * (column + 1) for _ in range(row + 1)]
stepped[current[0]][current[1]] = True
for i in range(row * column):
	moved = False
	print('%d %d' % (current[0], current[1]))
	stepped[current[0]][current[1]] = True
	done = True
	for j in range(column):
		if not stepped[current[0]][j + 1]:
			done = False
			break
	if not done:
		if current[1] == column and (not stepped[current[0]][1]):
			current[1] = 1
			moved = True
		elif not moved and (not stepped[current[0]][current[1] + 1]):
			current[1] += 1
			moved = True
	elif current[0] == row and (not moved) and (not stepped[1][current[1]]):
		current[0] = 1
		moved = True
	elif not moved and (not stepped[current[0] + 1][current[1]]):
		current[0] += 1
		moved = True


(n, m, x1, y1) = map(int, input().split())
print(x1, y1)
k = 1
while k < m + 1:
	if k != y1:
		print(x1, k)
	k += 1
i = 1
ch = k - 1
while i < n + 1:
	if i != x1:
		if ch == 1:
			j = 1
			while j < m + 1:
				print(i, j)
				j += 1
			ch = j - 1
		else:
			j = m
			while j > 0:
				print(i, j)
				j -= 1
			ch = j + 1
	i += 1


(m, n, x, y) = map(int, input().split())
print(x, y)
flag = False
for r in range(1, m + 1):
	flag = not flag
	for c in range(1, n + 1):
		row = (x + r - 1) % m
		if row == 0:
			row = m
		if flag:
			col = c
		else:
			col = n + 1 - c
		if (row, col) != (x, y):
			print(row, col)


import sys

def main():
	(n, m, Sx, Sy) = Imap()
	print(Sx, Sy)
	for i in range(1, n + 1):
		if i != Sx:
			print(i, Sy)
	row_no = n
	for j in range(1, m + 1):
		if j != Sy:
			how_to_go = 0
			if row_no == n:
				how_to_go = range(n, 0, -1)
			elif row_no == 1:
				how_to_go = range(1, n + 1)
			for i in how_to_go:
				print(i, j)
			row_no = n + 1 - row_no
FIO = 10

def I():
	return input()

def Iint():
	return int(input())

def Ilist():
	return list(map(int, input().split()))

def Imap():
	return map(int, input().split())

def Plist(li, s=' '):
	print(s.join(map(str, li)))
en = enumerate

def answer_debug(*args):
	print('\x1b[31m', *args, '\x1b[0m', file=sys.stderr)

def debug(*args):
	print('\x1b[36m', *args, '\x1b[0m', file=sys.stderr)
if not FIO:
	if __name__ == '__main__':
		main()
		exit()
else:
	from io import BytesIO, IOBase
	import os
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')
main()


(n, m, x, y) = map(int, input().strip().split(' '))
print(x, y)
print(x, 1)
i = 1
for j in range(1, m + 1):
	while 1:
		if i == x and j == y or (i == x and j == 1):
			pass
		else:
			print(i, j)
		if i == n:
			dec = True
			inc = False
			if j % 2 != 0:
				break
		elif i == 1:
			inc = True
			dec = False
			if j % 2 == 0:
				break
		if dec:
			i -= 1
		if inc:
			i += 1


import math
import sys

def main():
	(n, m, x, y) = [int(j) for j in input().split()]
	narr = []
	for i in range(1, n + 1):
		narr.append(i)
	marr = []
	for i in range(1, m + 1):
		marr.append(i)
	for j in range(1, m + 1):
		print(x, y)
		for i in range(1, n + 1):
			if i != x:
				print(i, y)
				ind = i
		x = ind
		y = y % m + 1
main()


def indexer(arr, x, y, n, m, first_traversal):
	ending_zero = y
	if x == first_traversal:
		indexer(arr, x + 1, ending_zero, n, m, first_traversal)
	else:
		pass
	if arr[x - 1][y] != 1:
		arr[x - 1][y] = 1
		print(x, y + 1)
	ending_zero = 0
	for i in range(m):
		if arr[x - 1][i] == 1:
			pass
		else:
			arr[x - 1][i] = 1
			print(x, i + 1)
			ending_zero = i
	if x == n:
		return 0
	else:
		return indexer(arr, x + 1, ending_zero, n, m, first_traversal)
(n, m, x, y) = map(int, input().split())
arr = [[0] * m for i in range(n)]
arr[x - 1][y - 1] = 1
print(x, y)
for i in range(m):
	if arr[x - 1][i] == 1:
		pass
	else:
		arr[x - 1][i] = 1
		print(x, i + 1)
indexer(arr, 1, m - 1, n, m, x)


(n, m, sx, sy) = map(int, input().split())
print(sx, sy)
cy = sy
for i in range(1, n + 1):
	py = cy
	if i != sx or cy != sy:
		print(i, cy)
	f = 0
	if i == sx - 1 and cy != sy:
		f = 1
		print(i, sy)
	for j in range(1, m + 1):
		if i == sx and j == sy:
			continue
		if j == py:
			continue
		if f and j == sy:
			continue
		print(i, j)
		cy = j


def func(row, col, a, b):
	skip = b
	for i in range(a, row):
		print(i + 1, b + 1)
	for i in range(a - 1, -1, -1):
		print(i + 1, b + 1)
	a = 0
	b = 0
	flag = True
	for i in range(col):
		if i == skip:
			continue
		for j in range(row):
			if flag == True:
				print(j + 1, i + 1)
			else:
				print(row - j, i + 1)
		flag = not flag
(n, m, x, y) = map(int, input().split())
func(n, m, x - 1, y - 1)


import sys

def traverse(A, B, x, y):
	ans = []
	ans.append((x, y))
	ans.append((x, 1))

def standard_traversal(A, B, initrow):
	ans = []
	count = 0
	for i in range(1, A + 1, 1):
		if initrow == i:
			continue
		count += 1
		if count % 2 == 1:
			jrange = range(1, B + 1, 1)
		else:
			jrange = range(B, 0, -1)
		for j in jrange:
			if not (i, j) in inits:
				ans.append((i, j))
	return ans

def invr():
	return map(int, input().split())
numbers = list(map(int, input().split()))
(A, B, x, y) = numbers
inits = [(x, y)]
for j in range(B, 0, -1):
	if j == y:
		continue
	else:
		inits.append((x, j))
ans = standard_traversal(A, B, x)
ans = inits + ans
ansstr = ''
for elem in ans:
	ansstr += '%d %d\n' % (elem[0], elem[1])
print(ansstr)


from sys import stdin, stdout
import math

def main():
	(n, m, x, y) = map(int, stdin.readline().split())
	(sx, sy) = (x, y)
	rows = {x}
	ans = [(x, y)]
	print(x, y)
	for i in range(1, m + 1):
		if i != y:
			print(x, i)
	col = m
	for r in range(1, n + 1):
		if r == x:
			continue
		if col == m:
			for c in range(m, 0, -1):
				print(r, c)
		else:
			for c in range(1, m + 1):
				print(r, c)
		col = m - col
main()


def main():
	from collections import defaultdict as dd
	(n, m, x, y) = map(int, input().split())
	a = []
	d = dd(lambda : 0)
	for i in range(x, 0, -1):
		a.append((i, y))
		d[i, y] = 1
	for i in range(y - 1, 0, -1):
		a.append((1, i))
		d[1, i] = 1
	for i in range(1, n + 1):
		if i % 2 == 0:
			for j in range(m, 0, -1):
				if (i, j) not in d:
					a.append((i, j))
					d[i, j] = 1
		else:
			for j in range(1, m + 1):
				if (i, j) not in d:
					a.append((i, j))
					d[i, j] = 1
	for i in a:
		print(*i)
	return
main()


def fn(n, m, ii, jj):
	for j in range(jj, 0, -1):
		print(ii, j)
	for j in range(jj + 1, m + 1):
		print(ii, j)
	i = 1
	dj = -1
	while i <= n:
		if i == ii:
			i += 1
		print(i, j)
		if not 0 < j + dj <= m:
			dj *= -1
			i += 1
		else:
			j += dj
(n, m, ii, jj) = (int(x) for x in input().split())
fn(n, m, ii, jj)


(n, m, x, y) = [*map(int, input().split())]
print(x, y)
for i in range(x + 1, n + 1):
	print(i, y)
for j in range(x - 1, 0, -1):
	print(j, y)
	(x1, y1) = (j, y)
r = y1
p = j
counter = 0
for i in range(y - 1, 0, -1):
	if counter % 2 == 0:
		for j in range(1, n + 1):
			print(j, i)
		counter += 1
	else:
		for j in range(n, 0, -1):
			print(j, i)
		counter += 1
for i in range(r + 1, m + 1):
	if counter % 2 == 0:
		for j in range(1, n + 1):
			print(j, i)
		counter += 1
	else:
		for j in range(n, 0, -1):
			print(j, i)
		counter += 1


import sys

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 ** 19
MOD = 10 ** 9 + 7
(W, H, sx, sy) = MAP()
sx -= 1
sy -= 1
ans = []
nx = sx
for ny in range(sy, sy + H):
	ny %= H
	for i in range(W):
		ans.append((nx + 1, ny + 1))
		if i != W - 1:
			nx = (nx + 1) % W
for (x, y) in ans:
	print(x, y)


(n, m, sx, sy) = map(int, input().split())
res = [(sx, sy)]
res.extend(((sx, y) for y in range(1, m + 1) if y != sy))
for (i, x) in enumerate((x for x in range(1, n + 1) if x != sx)):
	if i & 1:
		res.extend(((x, y) for y in range(1, m + 1)))
	else:
		res.extend(((x, y) for y in range(m, 0, -1)))
print('\n'.join((f'{x} {y}' for (x, y) in res)))


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
(n, m, x, y) = map(int, input().split())
print(x, y)
visited = [[0 for i in range(m + 1)] for j in range(n + 1)]
visited[x][y] = 1
print(1, y)
visited[1][y] = 1
print(1, 1)
visited[1][1] = 1
flag = 1
for i in range(1, n + 1):
	if flag:
		for j in range(1, m + 1):
			if not visited[i][j]:
				print(i, j)
				visited[i][j] = 1
	else:
		for j in range(m, 0, -1):
			if not visited[i][j]:
				print(i, j)
				visited[i][j] = 1
	flag = flag ^ 1


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
(n, m, x, y) = list(map(int, input().split()))
res = []
res.append([x, y])
for i in range(m):
	if i != y - 1:
		res.append([x, i + 1])
for i in range(n):
	last = res[-1]
	(lasx, lasy) = last
	if i != x - 1:
		res.append([i + 1, lasy])
		for j in range(m):
			if j != lasy - 1:
				res.append([i + 1, j + 1])
for ans in res:
	print(' '.join((str(x) for x in ans)))


(n, m, x, y) = map(int, input().split())
print(x, y)
print(1, y)
print(1, 1)
for i in range(1, n + 1):
	if i % 2 != 0:
		for j in range(1, m + 1):
			if i == 1 and j == y or (i == 1 and j == 1) or (i == x and j == y):
				continue
			print(i, j)
	else:
		j = m
		while j >= 1:
			if i == 1 and j == y or (i == 1 and j == 1) or (i == x and j == y):
				j -= 1
				continue
			print(i, j)
			j -= 1


import sys
import heapq
import math
from collections import deque
from collections import defaultdict
from collections import Counter
modH = int(10 ** 9) + 7
I = lambda : list(map(int, input().split(' ')))

def PRINT(lst, sep=' '):
	print(sep.join(map(str, lst)))
(n, m, sx, sy) = I()
visited = [[0 for i in range(m)] for j in range(n)]
global cnt
cnt = 1
aa = 0
for i in range(n):
	if aa % 2 == 0:
		for j in range(m):
			visited[(i + sx - 1) % n][(j + sy - 1) % m] = cnt
			cnt += 1
	else:
		for j in range(m - 1, -1, -1):
			visited[(i + sx - 1) % n][(j + sy - 1) % m] = cnt
			cnt += 1
	aa += 1
ans = []
for i in range(n):
	for j in range(m):
		ans.append((i + 1, j + 1))
ans.sort(key=lambda x: visited[x[0] - 1][x[1] - 1])
print('\n'.join(map(lambda x: str(x[0]) + ' ' + str(x[1]), ans)))


(n, m, x, y) = [int(k) for k in input().split()]
li = []
for i in range(1, n + 1):
	for j in range(1, m + 1):
		li.append([i, j])
print(x, y)
li.remove([x, y])
print(1, y)
li.remove([1, y])
cx = 1
while cx < n + 1:
	for jj in range(1, m + 1):
		if [cx, jj] in li:
			cy = jj
			print(cx, cy)
			li.remove([cx, cy])
	cx += 1
	for jj in range(m, 0, -1):
		if [cx, jj] in li:
			cy = jj
			print(cx, cy)
			li.remove([cx, cy])
	cx += 1


import sys
import math
import heapq
import collections
fast_reader = sys.stdin.readline
fast_writer = sys.stdout.write

def input():
	return fast_reader().strip()

def print(*argv):
	fast_writer(' '.join((str(i) for i in argv)))
	fast_writer('\n')

def printspace(*argv):
	fast_writer(' '.join((str(i) for i in argv)))
	fast_writer(' ')

def inputnum():
	return int(input())

def inputnums():
	return map(int, input().split())

def inputlist():
	return list(map(int, input().split()))

def inputstring():
	return [x for x in input()]

def inputmatrixchar(rows):
	arr2d = [[j for j in input().strip()] for i in range(rows)]
	return arr2d

def inputmatrixint(rows):
	arr2d = []
	for _ in range(rows):
		arr2d.append([int(i) for i in input().split()])
	return arr2d
(n, m, sx, sy) = inputnums()
print(sx, sy)
for i in range(1, m + 1):
	if i != sy:
		print(sx, i)
good = True
for i in range(sx + 1, n + 1):
	if good:
		for j in reversed(range(1, m + 1)):
			print(i, j)
		good = False
		continue
	else:
		for j in range(1, m + 1):
			print(i, j)
		good = True
		continue
for i in reversed(range(1, sx)):
	if good:
		for j in reversed(range(1, m + 1)):
			print(i, j)
		good = False
		continue
	else:
		for j in range(1, m + 1):
			print(i, j)
		good = True
		continue


(n, m, sx, sy) = input().split()
(n, m, sx, sy) = (int(n), int(m), int(sx), int(sy))
(nn, mm) = (n, m)
while nn > 0:
	nn -= 1
	mm = m
	while mm > 0:
		mm -= 1
		if sx > n:
			sx -= n
		if sy > m:
			sy -= m
		print(sx, sy)
		if mm != 0:
			sy += 1
	sx += 1


def frow():
	print(x, y)
	for jj in range(1, m + 1):
		if jj != y:
			print(x, jj)
(n, m, x, y) = map(int, input().split())
frow()
temp = m
for kk in range(1, n + 1):
	if kk == x:
		continue
	elif temp == 0:
		for ll in range(1, m + 1):
			print(kk, ll)
			temp = m
	else:
		for ll in range(m, 0, -1):
			print(kk, ll)
			temp = 0


(n, m, x, y) = map(int, input().split(' '))
print(x, y)
(x1, y1) = (x, y)
for i in range(1, n):
	if x < n:
		x += 1
		print(x, y)
	else:
		x1 -= 1
		print(x1, y)
else:
	x = x1 - 1
	k = 1
for j in range(1, m):
	if y1 != j:
		y = k
	else:
		k = j + 1
		y = k
	k += 1
	for i in range(1, n + 1):
		if x < n:
			x += 1
			x1 = x
			print(x, y)
		else:
			x1 -= 1
			print(x1, y)
	else:
		x = x1 - 1


[n, m, x, y] = list(map(int, input().split()))
print(x, y)
count = 1
rstart = 1
cstart = x
while count < m * n:
	if rstart == 1:
		for j in range(rstart, m + 1):
			if j == y and cstart == x:
				continue
			else:
				print(cstart, j)
				count += 1
	else:
		for j in range(rstart, 0, -1):
			if j == y and cstart == x:
				continue
			else:
				print(cstart, j)
				count += 1
	if cstart > 1 and cstart <= x:
		cstart -= 1
		if rstart == 1:
			rstart = m
		else:
			rstart = 1
	elif cstart == 1:
		cstart = x + 1
		if rstart == 1:
			rstart = m
		else:
			rstart = 1
	elif cstart > 1 and cstart > x:
		cstart += 1
		if rstart == 1:
			rstart = m
		else:
			rstart = 1


(n, m, x, y) = map(int, input().split())
s = {(x, y)}
print(x, y)
if x != 1:
	print(1, y)
	s.add((1, y))
if y != 1:
	print(1, 1)
	s.add((1, 1))
count = 0
while count < n * m:
	i = 1
	j = 1
	while i <= n:
		while j <= m:
			count += 1
			if (i, j) in s:
				j += 1
				continue
			else:
				print(i, j)
				s.add((i, j))
				j += 1
		if j > m:
			j = m
			i += 1
			if i <= n:
				while j >= 1:
					count += 1
					if (i, j) in s:
						j -= 1
						continue
					else:
						print(i, j)
						s.add((i, j))
						j -= 1
				if j < 1:
					j = 1
					i += 1


import sys
pr = sys.stdout.write

def main():
	(n, m, x, y) = map(int, [*open(0)][0].split())
	pr(f'{x} {y}\n')
	t = -1
	for i in range(1, n + 1):
		if i != x:
			pr(f'{i} {y}\n')
	for j in range(1, m + 1):
		if j == y:
			continue
		for i in range(*((1, n + 1) if t > 0 else (n, 0)), t):
			pr(f'{i} {j}\n')
		t *= -1
main()


from sys import stdin, stdout
from collections import Counter, OrderedDict
import math
cin = stdin.readline
cout = stdout.write
mp = lambda : list(map(int, cin().split()))

def chars():
	s = cin()
	return list(s[:len(s) - 1])

def pl(a):
	for val in a:
		cout(str(val) + ' ')
	cout('\n')

def func(x, y, n):
	while x <= n:
		if y == 1:
			for i in range(1, m + 1):
				pl([x, i])
				y = i
		elif y == m:
			for i in range(m, 0, -1):
				pl([x, i])
				y = i
		if x == n:
			x = 1
			break
		x += 1
	return (x, y)
for _ in range(1):
	(n, m, x, y) = mp()
	p = x
	for i in range(y, 0, -1):
		pl([x, i])
	for i in range(y + 1, m + 1):
		pl([x, i])
		y = i
	(x, y) = func(x + 1, y, n)
	(x, y) = func(1, y, p - 1)


(n, m, x, y) = map(int, input().split())
print(' '.join([str(x), str(y)]))
for j in range(1, m + 1):
	if j != y:
		print(' '.join([str(x), str(j)]))
for i in range(1, n + 1):
	if i == x:
		continue
	elif i < x:
		if i % 2 == 1:
			for j in range(m, 0, -1):
				print(' '.join([str(i), str(j)]))
		else:
			for j in range(1, m + 1):
				print(' '.join([str(i), str(j)]))
	elif i > x:
		if i % 2 == 1:
			for j in range(1, m + 1):
				print(' '.join([str(i), str(j)]))
		else:
			for j in range(m, 0, -1):
				print(' '.join([str(i), str(j)]))


def st(x, y):
	return str(x) + ' ' + str(y)
(n, m, x, y) = map(int, input().split())
u = []
for i in range(n):
	u.append([0] * m)
ans = []
ans.append(st(x, y))
u[x - 1][y - 1] = 1
y = 1
ans.append(st(x, y))
u[x - 1][y - 1] = 1
x = 1
for j in range(m):
	for i in range(n):
		if u[x - 1][y - 1] != 1:
			u[x - 1][y - 1] = 1
			ans.append(st(x, y))
		if i == n - 1:
			y += 1
		elif j % 2 == 0:
			x += 1
		else:
			x -= 1
print('\n'.join(ans))


def tc():
	(n, m, sx, sy) = map(int, input().split())
	rev = True
	y_order = [sy]
	print(sx, sy)
	for j in range(1, m + 1):
		if j == sy:
			continue
		print(sx, j)
		y_order.append(j)
	for i in range(1, n + 1):
		if i == sx:
			continue
		ran = reversed(y_order) if rev else y_order
		for j in ran:
			print(i, j)
		rev = not rev
tc()


def do1(i, x, y):
	while i >= 1:
		for k in range(y, 0, -1):
			print(i, k)
		i -= 1
		if i >= 1:
			for k in range(1, y + 1):
				print(i, k)
			i -= 1

def do2(i, x, y):
	while i <= x:
		for k in range(y, 0, -1):
			print(i, k)
		i += 1
		if i <= x:
			for k in range(1, y + 1):
				print(i, k)
			i += 1

def done1(i, x, y):
	while i >= 1:
		for k in range(1, y + 1):
			print(i, k)
		i -= 1
		if i >= 1:
			for k in range(y, 0, -1):
				print(i, k)
			i -= 1

def done2(i, x, y):
	while i <= x:
		for k in range(1, y + 1):
			print(i, k)
		i += 1
		if i <= x:
			for k in range(y, 0, -1):
				print(i, k)
			i += 1
(x, y, a, b) = map(int, input().split())
l = []
for i in range(b, y + 1):
	l.append((a, i))
	print(a, i)
for i in range(b - 1, 0, -1):
	l.append((a, i))
	print(a, i)
lastcolumn = l[len(l) - 1][1]
lastrow = l[len(l) - 1][0]
if lastrow - 1 >= 1 and lastcolumn == y:
	do1(lastrow - 1, x, y)
elif lastrow - 1 >= 1:
	done1(lastrow - 1, x, y)
if lastrow % 2 == 0 and lastrow + 1 <= x and (lastcolumn == y):
	done2(lastrow + 1, x, y)
elif lastrow % 2 == 0 and lastrow + 1 <= x and (lastcolumn == 1):
	do2(lastrow + 1, x, y)
elif lastrow % 2 != 0 and lastrow + 1 <= x and (lastcolumn == y):
	do2(lastrow + 1, x, y)
elif lastrow % 2 != 0 and lastrow + 1 <= x and (lastcolumn == 1):
	done2(lastrow + 1, x, y)


import sys
from math import ceil, factorial, gcd
from collections import Counter, deque, defaultdict
from bisect import bisect_left, bisect_right
from heapq import heappop, heappush, heapify
MOD = 10 ** 9 + 7
INF = float('inf')
rl = lambda : list(map(int, sys.stdin.readline().split()))
rs = lambda : sys.stdin.readline().strip()
(n, m, sx, sy) = rl()
visited = [[False for _ in range(m + 1)] for _ in range(n + 1)]
visited[sx][sy] = True
visited[1][sy] = True
print(sx, sy)
print(1, sy)
for row in range(1, n + 1):
	if row % 2:
		for col in range(1, m + 1):
			if not visited[row][col]:
				print(row, col)
	else:
		for col in range(m, 0, -1):
			if not visited[row][col]:
				print(row, col)


import sys

def solve(n, m, sx, sy):
	print(sx, sy)
	print(sx, m)
	for y in range(m - 1, sy, -1):
		print(sx, y)
	for y in range(sy - 1, 0, -1):
		print(sx, y)
	for x in range(1, sx):
		yorder = range(m, 0, -1) if x % 2 == 0 else range(1, m + 1)
		for y in yorder:
			print(x, y)
	for x in range(sx + 1, n + 1):
		yorder = range(m, 0, -1) if x % 2 == 1 else range(1, m + 1)
		for y in yorder:
			print(x, y)
IN = [x.strip() for x in sys.stdin.readlines()]
(n, m, sx, sy) = [int(x) for x in IN[0].split(' ')]
res = solve(n, m, sx, sy)


(n, m, x, y) = list(map(int, input().split()))
x -= 1
y -= 1
path = [(x, y)]
visited = set([(x, y)])
for i in range(n):
	for j in range(m):
		if (i, j) in visited:
			continue
		(px, py) = path[-1]
		while px < i:
			px += 1
			if (px, py) not in visited:
				path.append((px, py))
				visited.add((px, py))
		while px > i:
			px -= 1
			if (px, py) not in visited:
				path.append((px, py))
				visited.add((px, py))
		while py < j:
			py += 1
			if (px, py) not in visited:
				path.append((px, py))
				visited.add((px, py))
		while py > j:
			py -= 1
			if (px, py) not in visited:
				path.append((px, py))
				visited.add((px, py))
for (x, y) in path:
	print('{} {}'.format(x + 1, y + 1))


(n, m, x, y) = map(int, input().split())
start_x = x
start_y = y
while x <= n:
	print(x, y)
	x += 1
x = start_x - 1
while x > 0:
	print(x, y)
	x -= 1
x = 1
y -= 1
up = True
while y > 0:
	if up:
		while x <= n:
			print(x, y)
			x += 1
		x = n
		up = False
	else:
		while x > 0:
			print(x, y)
			x -= 1
		x = 1
		up = True
	y -= 1
y = start_y + 1
while y <= m:
	if up:
		while x <= n:
			print(x, y)
			x += 1
		x = n
		up = False
	else:
		while x > 0:
			print(x, y)
			x -= 1
		x = 1
		up = True
	y += 1


import sys
input = sys.stdin.buffer.readline

def main():
	(n, m, sx, sy) = map(int, input().split())
	print(sx, sy)
	for i in range(1, m + 1):
		if i == sy:
			continue
		print(sx, i)
	d = -1
	y = i
	for j in range(1, n + 1):
		if j == sx:
			continue
		print(j, y)
		for _ in range(m - 1):
			y += d
			print(j, y)
		d *= -1
main()


(n, m, Sx, Sy) = [int(i) for i in input().split()]
arr = [[0 for i in range(m)] for i in range(n)]
print(Sx, Sy)
print(Sx, m)
for i in range(m - 1, -1, -1):
	arr[Sx - 1][i] = 1
	if i != Sy - 1 and i != m - 1:
		print(Sx, i + 1)
c = 0
for i in range(n):
	if i == Sx - 1:
		continue
	elif c % 2 == 0:
		for j in range(m):
			if arr[i][j] == 0:
				arr[i][j] = 1
				print(i + 1, j + 1)
	else:
		for j in range(m - 1, -1, -1):
			if arr[i][j] == 0:
				arr[i][j] = 1
				print(i + 1, j + 1)
	c += 1


(n, m, a, b) = map(int, input().split())
print(a, b)
if a == 1 and b == 1:
	c = 1
elif a == 1:
	for i in range(1, m + 1):
		if i != b:
			print(1, i)
elif b == 1:
	for i in range(1, n + 1):
		if i != a:
			print(i, 1)
else:
	for i in range(1, m + 1):
		if i != b:
			print(a, i)
	i = 1
	j = m
	print(i, j)
	j = m - 1
	count = 1
	change = -1
	if n % 2 != 0:
		end = m
	else:
		end = 1
	check = 1
	count = -1
	tot = 1
	while True:
		print(i, j)
		count += 1
		if count == 0:
			tot += 1
		if tot == n and j == end:
			break
		if j == 1 and count > 0:
			j = 0
			change = 1
			i += 1
			count = -1
		if j == m and count > 0:
			j = m + 1
			flag = 0
			change = -1
			i += 1
			count = -1
		if i == a:
			i += 1
		j = j + change


(n, m, x, y) = map(int, input().split())
l = [[x, y]]
flag = 0
for j in range(1, m + 1):
	if j != y:
		l.append([x, j])
for i in range(x + 1, n + 1):
	if flag == 0:
		for j in range(m, 0, -1):
			l.append([i, j])
		flag = 1
	else:
		for j in range(1, m + 1):
			l.append([i, j])
		flag = 0
for i in range(x - 1, 0, -1):
	if flag == 0:
		for j in range(m, 0, -1):
			l.append([i, j])
		flag = 1
	else:
		for j in range(1, m + 1):
			l.append([i, j])
		flag = 0
for i in range(len(l)):
	print(str(l[i][0]) + ' ' + str(l[i][1]))


(n, m, start1, start2) = map(int, input().split())
result = {(start1, start2): 1}
visited = [[start1, start2]]
count = n * m - 1
r = start1
rounds = 0
while count > 0:
	if rounds % 2 == 1:
		for x in range(m, 0, -1):
			try:
				if result[r, x] == 1:
					pass
			except:
				count -= 1
				result[r, x] = 1
				visited.append([r, x])
	else:
		for x in range(1, m + 1):
			try:
				if result[r, x] == 1:
					pass
			except:
				count -= 1
				result[r, x] = 1
				visited.append([r, x])
	rounds += 1
	if r == n:
		r = 1
	else:
		r += 1
for x in visited:
	print(x[0], x[1])


(x, y, s_x, s_y) = map(int, input().split())
x_set = set([c for c in range(1, x + 1)])
y_set = set([r for r in range(1, y + 1) if r != s_y])
last_x = -1
last_y = -1
print(f'{s_x} {s_y}')
for i in range(x, 0, -1):
	if i != s_x:
		print(f'{i} {s_y}')
		last_x = i
while x_set:
	if last_x > 0:
		curr_x = last_x
		x_set.remove(curr_x)
		last_x = -1
	else:
		curr_x = x_set.pop()
	while y_set:
		if last_y > 0:
			curr_y = last_y
			y_set.remove(curr_y)
			last_y = -1
		else:
			curr_y = y_set.pop()
		if len(y_set) == 0:
			last_y = curr_y
		print(f'{curr_x} {curr_y}')
	y_set = set([r for r in range(1, y + 1) if r != s_y])


(n, m, x, y) = map(int, input().split())
print(x, y)
print(1, y)
(f1, f2) = (x, y)
for x in range(1, n + 1):
	if x % 2 != 0:
		for y in range(1, m + 1):
			if [x, y] != [f1, f2] and [x, y] != [1, f2]:
				print(x, y)
	else:
		for y in range(m, 0, -1):
			if [x, y] != [f1, f2] and [x, y] != [1, f2]:
				print(x, y)


(n, m, sx, sy) = map(int, input().split())
firstright = sx
while firstright <= n:
	print(firstright, sy)
	firstright += 1
firstleft = sx - 1
while firstleft >= 1:
	print(firstleft, sy)
	firstleft -= 1
x = 1
y = sy - 1
while y >= 1:
	if x == 1:
		while x <= n:
			print(x, y)
			x += 1
		x -= 1
	elif x == n:
		while x >= 1:
			print(x, y)
			x -= 1
		x += 1
	y -= 1
y = sy + 1
while y <= m:
	if x == 1:
		while x <= n:
			print(x, y)
			x += 1
		x -= 1
	elif x == n:
		while x >= 1:
			print(x, y)
			x -= 1
		x += 1
	y += 1


(n, m, Sx, Sy) = map(int, input().split())
Sx -= 1
Sy -= 1
c = Sy
ans = []
s = Sx
for j in range(Sx, n):
	ans.append((j + 1, Sy + 1))
	for i in range(m):
		if i == Sy:
			continue
		else:
			ans.append((j + 1, i + 1))
			cur = i
	Sy = cur
for j in range(Sx):
	ans.append((j + 1, Sy + 1))
	for i in range(m):
		if i == Sy:
			continue
		else:
			ans.append((j + 1, i + 1))
			cur = i
	Sy = cur
for i in range(len(ans)):
	print(*ans[i])


(n, m, Sx, Sy) = map(int, input().split())
col = 0
x = 0
print(Sx, Sy)
for i in range(1, m + 1):
	if i != Sy:
		print(Sx, i)
		col = i
for i in range(1, n + 1):
	if i == Sx:
		continue
	else:
		print(i, col)
		for k in range(1, m + 1):
			if k != col:
				print(i, k)
				x = k
		col = x


import sys
input = sys.stdin.readline
(n, m, sx, sy) = map(int, input().split())
v = [[0 for i in range(m + 1)] for i in range(n + 1)]

def func(sx, sy):
	ny = sy
	for i in range(1, m + 1):
		if v[sx][i] == 0:
			v[sx][i] = 1
			print(sx, i)
			ny = i
	if sx != n:
		if v[sx + 1][ny] == 0:
			v[sx + 1][ny] = 1
			print(sx + 1, ny)
			func(sx + 1, ny)
		elif v[sx + 1][ny] == 1:
			v[sx + 2][ny] = 1
			print(sx + 2, ny)
			func(sx + 2, ny)
			v[sx + 1][m] = 1
			print(sx + 1, m)
			for i in range(1, m + 1):
				if v[sx + 1][i] == 0:
					v[sx + 1][i] = 1
					print(sx + 1, i)
	else:
		return
v[sx][sy] = 1
print(sx, sy)
sy = 1
v[sx][sy] = 1
print(sx, sy)
sx = 1
v[sx][sy] = 1
print(sx, sy)
func(sx, sy)


(n, m, x, y) = map(int, input().split())
used = [[0 for i in range(m)] for i in range(n)]
x -= 1
y -= 1
used[x][y] = 1
used[0][y] = 1
print(x + 1, y + 1)
print(1, y + 1)
x = y = 0
for i in range(n * m - 3):
	print(x + 1, y + 1)
	used[x][y] = 1
	q = x % 2
	if q == 0:
		if y == m - 1:
			x += 1
		else:
			y += 1
			if used[x][y] == 1:
				y += 1
	elif y == 0:
		x += 1
	else:
		y -= 1
		if used[x][y] == 1:
			y -= 1
print(x + 1, y + 1)


(n, m, line, column) = [int(element) for element in input().split(' ')]
answer = []
if column == 1:
	for y in range(1, m + 1):
		answer.append(str(line) + ' ' + str(y))
	actual = m
elif column == m:
	for y in range(m):
		answer.append(str(line) + ' ' + str(m - y))
	actual = 1
else:
	answer.append(str(line) + ' ' + str(column))
	for y in range(1, m + 1):
		if y != column:
			answer.append(str(line) + ' ' + str(y))
	actual = m
for i in range(1, n + 1):
	if i != line:
		if actual == 1:
			for j in range(1, m + 1):
				answer.append(str(i) + ' ' + str(j))
			actual = m
		else:
			for j in range(m):
				answer.append(str(i) + ' ' + str(m - j))
			actual = 1
print('\n'.join(answer))


from sys import stdin, stdout
from itertools import combinations
from collections import defaultdict, Counter
import math

def listIn():
	return list(map(int, stdin.readline().strip().split()))

def stringListIn():
	return [x for x in stdin.readline().split()]

def intIn():
	return int(stdin.readline())

def stringIn():
	return stdin.readline().strip()
(n, m, x, y) = listIn()
ans = []
print(x, y)
for i in range(1, y):
	print(x, i)
for i in range(y + 1, m + 1):
	print(x, i)
f = 0
for i in range(x - 1, 0, -1):
	if f == 0:
		f = 1
		for j in range(m, 0, -1):
			print(i, j)
	else:
		f = 0
		for j in range(1, m + 1):
			print(i, j)
for i in range(x + 1, n + 1):
	if f == 0:
		f = 1
		for j in range(m, 0, -1):
			print(i, j)
	else:
		f = 0
		for j in range(1, m + 1):
			print(i, j)


from sys import stdin
input = lambda : stdin.readline().strip()
from math import ceil, sqrt, factorial, gcd
from collections import deque
(n, m, x, y) = map(int, input().split())
print(x, y)
x -= 1
for i in range(n):
	for j in range(m - 1):
		print(x % n + 1, y % m + 1)
		y += 1
	y -= 1
	x += 1
	if i != n - 1:
		print(x % n + 1, y % m + 1)
	y += 1


from fractions import Fraction
import bisect
import os
import io
from collections import Counter
import bisect
from collections import defaultdict
import math
import random
import heapq
from math import sqrt
import sys
from functools import reduce, cmp_to_key
from collections import deque
import threading
from itertools import combinations
from io import BytesIO, IOBase
from itertools import accumulate
from queue import Queue

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def tinput():
	return input().split()

def rinput():
	return map(int, tinput())

def rlinput():
	return list(rinput())
mod = int(1000000000.0) + 7

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))
t = 1
for _ in range(t):
	(x, y, sx, sy) = rinput()
	ans = [(sx, sy)]
	for i in range(sy + 1, y + 1):
		ans.append((sx, i))
	for i in range(sy - 1, 0, -1):
		ans.append((sx, i))
	moves = 0
	for i in range(sx - 1, 0, -1):
		for j in range(1, y + 1):
			if moves % 2 == 0:
				ans.append((i, j))
			else:
				ans.append((i, y - j + 1))
		moves ^= 1
	for i in range(sx + 1, x + 1):
		for j in range(1, y + 1):
			if moves % 2 == 0:
				ans.append((i, j))
			else:
				ans.append((i, y - j + 1))
		moves ^= 1
	for (a, b) in ans:
		print(a, b)


(n, m, x, y) = list(map(int, input().split()))
matrix = [[0] * m for i in range(n)]
ans = [[x, y]]
matrix[x - 1][y - 1] = 1
matrix[0][y - 1] = 1
ans.append([1, y])
for i in range(n):
	if i % 2 == 0:
		for j in range(m):
			if matrix[i][j] == 0:
				matrix[i][j] = 1
				ans.append([i + 1, j + 1])
	else:
		for j in range(1, m + 1):
			if matrix[i][-j] == 0:
				matrix[i][-j] = 1
				ans.append([i + 1, m - j + 1])
for i in range(n * m):
	print(' '.join((str(x) for x in ans[i])))


production = True
import sys, math, collections, bisect, itertools, heapq, decimal, random, copy, re

def input(f=0, m=0):
	if m > 0:
		return [input(f) for i in range(m)]
	else:
		l = sys.stdin.readline()[:-1]
		if f >= 10:
			u = False
			f = int(str(f)[-1])
		else:
			u = True
		if f == 0:
			p = [l]
		elif f == 1:
			p = list(map(int, l.split()))
		elif f == 2:
			p = list(map(float, l.split()))
		elif f == 3:
			p = list(l)
		elif f == 4:
			p = list(map(int, list(l)))
		elif f == 5:
			p = l.split()
		return p if u else p[0]

def out(l, f=0, n=True):
	if f == 0:
		p = str(l)
	elif f == 1:
		p = ' '.join(map(str, l))
	elif f == 2:
		p = '\n'.join(map(str, l))
	elif f == 3:
		p = ''.join(map(str, l))
	print(p, end='\n' if n else '')

def log(*args):
	if not production:
		print('$$$', end='')
		print(*args)
enu = enumerate
ter = lambda a, b, c: b if a else c
ceil = lambda a, b: -(-a // b)

def mapl(i, f=0):
	if f == 0:
		return list(map(int, i))
	elif f == 1:
		return list(map(str, i))
	elif f == 2:
		return list(map(list, i))

def col(n, x, s):
	out([x, s], 1)
	f = 0
	for i in range(1, n + 1):
		if i == s:
			continue
		f = i
		out([x, i], 1)
	return f

def solve():
	(n, m, x, y) = input(1)
	s = col(m, x, y)
	for i in range(1, n + 1):
		if i == x:
			continue
		s = col(m, i, s)
	log()
	return
solve()


def main():
	(n, m, sy, sx) = map(int, input().split())
	for i1 in range(sx, 0, -1):
		print(sy, i1)
	print(sy, sx + 1)
	for i2 in range(sx + 2, m + 1):
		print(sy, i2)
	at_end = True
	for i in range(1, n + 1):
		if i == sy:
			continue
		if at_end:
			for j in range(m, 0, -1):
				print(i, j)
		else:
			for j in range(1, m + 1):
				print(i, j)
		at_end = not at_end
main()


def colup(x, y):
	while x <= n:
		if x == sx and y == sy or (x == sx1 and y == sy1):
			pass
		else:
			print(x, y)
		x = x + 1

def coldown(x, y):
	while x >= 1:
		if x == sx and y == sy or (x == sx1 and y == sy1):
			pass
		else:
			print(x, y)
		x = x - 1
(n, m, sx, sy) = map(int, input().split())
print(sx, sy)
sx1 = sx
sy1 = 1
print(sx1, sy1)
x = 1
for y in range(1, m + 1):
	if y % 2 != 0:
		colup(1, y)
	else:
		coldown(n, y)


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


(n, m, x, y) = map(int, input().split())
st = x
for i in range(y, 0, -1):
	print(x, i)
for i in range(y + 1, m + 1):
	print(x, i)
now = m
while x > 1:
	x -= 1
	if now > 1:
		for i in range(m):
			print(x, now)
			now -= 1
		now += 1
	else:
		for i in range(m):
			print(x, now)
			now += 1
		now -= 1
x = st + 1
while x <= n:
	if now > 1:
		for i in range(m):
			print(x, now)
			now -= 1
		now += 1
	else:
		for i in range(m):
			print(x, now)
			now += 1
		now -= 1
	x += 1


def boboniu(n, m, x, y):
	print(x, y)
	for i in reversed(range(1, x)):
		print(i, y)
	for i in range(x + 1, n + 1):
		print(i, y)
	x = i
	flag = 0
	for j in reversed(range(1, y)):
		if flag == 0:
			for i in reversed(range(1, n + 1)):
				print(i, j)
			flag = 1
		else:
			for i in range(1, n + 1):
				print(i, j)
			flag = 0
	for j in range(y + 1, m + 1):
		if flag == 0:
			for i in reversed(range(1, n + 1)):
				print(i, j)
			flag = 1
		else:
			for i in range(1, n + 1):
				print(i, j)
			flag = 0
(a, b, c, d) = map(int, input().split())
boboniu(a, b, c, d)


l = list(map(int, input().split()))
l[2] -= 1
l[3] -= 1
for i in range(l[0]):
	for j in range(l[1] - 1):
		print(l[2] + 1, l[3] + 1)
		l[3] = (l[3] + 1) % l[1]
	print(l[2] + 1, l[3] + 1)
	l[2] = (l[2] + 1) % l[0]


(n, m, sx, sy) = list(map(int, input().split()))
ans = [[sx, sy]]
for j in range(sy + 1, m + 1):
	ans.append([sx, j])
for j in range(sy - 1, 0, -1):
	ans.append([sx, j])
l = 1
h = m + 1
for i in range(sx + 1, n + 1):
	if l == 1:
		for j in range(l, h):
			ans.append([i, j])
	elif l == m:
		for j in range(l, h, -1):
			ans.append([i, j])
	if l == 1:
		l = m
		h = 0
	elif l == m:
		l = 1
		h = m + 1
for i in range(sx - 1, 0, -1):
	if l == 1:
		for j in range(l, h):
			ans.append([i, j])
	elif l == m:
		for j in range(l, h, -1):
			ans.append([i, j])
	if l == 1:
		l = m
		h = 0
	elif l == m:
		l = 1
		h = m + 1
for i in range(len(ans)):
	print(ans[i][0], ans[i][1])


def fu(a, b, d, x):
	for i in range(a, b, d):
		print(x, i)
(n, m, x, y) = input().split()
n = int(n)
m = int(m)
x = int(x)
y = int(y)
for i in range(y, m + 1):
	print(x, i)
for i in range(y - 1, 0, -1):
	print(x, i)
c = 0
for i in range(x + 1, n + 1):
	if c == 0:
		fu(1, m + 1, 1, i)
		c = 1
	else:
		fu(m, 0, -1, i)
		c = 0
for i in range(1, x):
	if c == 0:
		fu(1, m + 1, 1, i)
		c = 1
	else:
		fu(m, 0, -1, i)
		c = 0


def travel(n, m, x, y, v):
	j = 0
	for i in range(n):
		if not v[i][y]:
			print(i + 1, y + 1)
			v[i][y] += True
			j = i
	return (j, v)
(n, m, x, y) = [int(_) for _ in input().split()]
v = [[False for _ in range(m)] for _ in range(n)]
temp = x - 1
for i in range(y - 1, m):
	v[temp][i] = True
	print(temp + 1, i + 1)
	(temp, v) = travel(n, m, temp, i, v)
j = temp
k = m - 1
while v[j][k]:
	k -= 1
for i in range(0, k + 1):
	v[j][i] = True
	print(j + 1, i + 1)
	(j, v) = travel(n, m, j, i, v)


(n, m, sx, sy) = list(map(int, input().split()))
print(sx, sy)
for j in range(1, m + 1):
	if j != sy:
		print(sx, j)
curr = m
for i in range(1, n + 1):
	if i != sx:
		if curr == m:
			for j in range(m, 0, -1):
				print(i, j)
				curr = 0
		else:
			for j in range(1, m + 1):
				print(i, j)
				curr = m


(n, m, x, y) = map(int, input().split())
print(x, y)
for i in range(1, y):
	print(x, i)
for i in range(y + 1, m + 1):
	print(x, i)
vis = [False] * n
vis[x - 1] = True
swap = 0
for i in range(0, n):
	if vis[i]:
		swap = 1
		continue
	if not swap:
		if i % 2 == 0:
			for j in range(m, 0, -1):
				print(i + 1, j)
		else:
			for j in range(1, m + 1):
				print(i + 1, j)
	elif i % 2 == 1:
		for j in range(m, 0, -1):
			print(i + 1, j)
	else:
		for j in range(1, m + 1):
			print(i + 1, j)


(n, m, x, y) = [int(x) for x in input().split()]
a = [[0] * m] * n
print(x, y)
a[x - 1][y - 1] = 1
first = y
second = x
done = True
for i in range(m - 1):
	if y > 1 and done:
		y -= 1
		print(x, y)
		a[x - 1][y - 1] = 1
	else:
		if done:
			y = first
		done = False
		y += 1
		print(x, y)
		a[x - 1][y - 1] = 1
x -= 1
while x >= 1:
	if y == m:
		first = -1
	else:
		first = 1
	for i in range(m):
		print(x, y)
		a[x - 1][y - 1] = 1
		y += first
	y -= first
	x -= 1
x = second
x += 1
while x <= n:
	if y == m:
		first = -1
	else:
		first = 1
	for i in range(m):
		print(x, y)
		a[x - 1][y - 1] = 1
		y += first
	y -= first
	x += 1


(n, m, s1, s2) = map(int, input().split(' '))
ans = [(s1, s2)]
for i in range(1, s2):
	ans.append((s1, i))
for i in range(s2 + 1, m + 1):
	ans.append((s1, i))
i = s1 - 1
while i >= 1:
	x = ans[-1]
	ans.append((i, x[1]))
	for j in range(1, x[1]):
		ans.append((i, j))
	for j in range(x[1] + 1, m + 1):
		ans.append((i, j))
	i -= 1
i = s1 + 1
while i <= n:
	x = ans[-1]
	ans.append((i, x[1]))
	for j in range(1, x[1]):
		ans.append((i, j))
	for j in range(x[1] + 1, m + 1):
		ans.append((i, j))
	i += 1
for i in ans:
	print(i[0], i[1])


import sys
ii = lambda : sys.stdin.readline().strip()
idata = lambda : [int(x) for x in ii().split()]

def main():
	(n, m, x, y) = idata()
	print(x, y)
	for i in range(y - 1):
		print(x, i + 1)
	for i in range(m - y):
		print(x, i + 1 + y)
	flag = 1
	for i in range(n):
		if i != x - 1:
			if flag:
				for j in range(m, 0, -1):
					print(i + 1, j)
			else:
				for j in range(1, m + 1):
					print(i + 1, j)
			flag = (flag + 1) % 2
	return
main()


def move(n, m, x, y):
	end = False
	print(x, y)
	for j in range(1, m + 1):
		if j != y:
			print(x, j)
	for i in range(1, n + 1):
		if i != x:
			if end:
				for j in range(1, m + 1):
					print(i, j)
			else:
				for j in range(m, 0, -1):
					print(i, j)
			end = not end
(n, m, x, y) = map(int, input().split())
move(n, m, x, y)


from sys import stdin, stdout

def rl(p, q):
	while q > 0:
		print(p, q)
		q -= 1

def lr(p, q):
	while q <= c:
		print(p, q)
		q += 1
for _ in range(1):
	(r, c, x, y) = map(int, stdin.readline().split())
	(sx, sy) = (x, y)
	while y > 0:
		print(x, y)
		y -= 1
	for yy in range(sy + 1, c + 1):
		print(x, yy)
	y = c
	x += 1
	while x <= r:
		if y == c:
			rl(x, y)
			y = 1
		elif y == 1:
			lr(x, y)
			y = c
		x += 1
	x = sx - 1
	while x >= 1:
		if y == c:
			rl(x, y)
			y = 1
		elif y == 1:
			lr(x, y)
			y = c
		x -= 1


from sys import stdin, stdout
import math, queue, heapq
fastinput = stdin.readline
fastout = stdout.write
t = 1
while t:
	t -= 1
	(n, m, sx, sy) = map(int, fastinput().split())
	visited = []
	visited.append([sx, sy])
	visited.append([1, sy])
	visited.append([1, 1])
	for i in visited:
		print(*i)
	x = 1
	j = 1
	for i in range(1, n + 1):
		while j >= 1 and j <= m:
			if [i, j] in visited:
				j += x
				continue
			else:
				print(i, j)
				j += x
		if j == 0:
			j = 1
		if j == m + 1:
			j = m
		if j == m:
			x = -1
		else:
			x = 1


(n, m, sx, sy) = map(int, input().split())
for i in range(sy):
	print(sx, sy - i)
for i in range(m - sy):
	print(sx, sy + i + 1)
end = True
for i in reversed(range(1, sx)):
	for j in range(m):
		if end == True:
			print(i, m - j)
		else:
			print(i, j + 1)
	end = not end
for i in range(sx + 1, n + 1):
	for j in range(m):
		if end == True:
			print(i, m - j)
		else:
			print(i, j + 1)
	end = not end


import sys, math, heapq, collections, itertools, bisect
sys.setrecursionlimit(101000)
(n, m, r, c) = map(int, input().split())
sol = [(r, c), (1, c)]
skip = [(r, c), (1, c)]
(rr, cc, dc) = (1, 1, 1)
while rr <= n:
	while 1 <= cc <= m:
		if (rr, cc) not in skip:
			sol.append((rr, cc))
		cc += dc
	rr += 1
	if dc == 1:
		cc -= 1
		dc = -1
	else:
		cc += 1
		dc = 1
for (r, c) in sol:
	print(r, c)


(n, m, sx, sy) = map(int, input().split())
print(sx, sy)
v = [[1] * (m + 1) for _ in range(n + 1)]
print(1, sy)
v[sx][sy] = 0
v[1][sy] = 0
for i in range(n):
	a = []
	for j in range(m):
		if v[i + 1][j + 1]:
			a.append((i + 1, j + 1))
			v[i + 1][j + 1] = 0
	if i % 2 != 0:
		a.reverse()
	for (x, y) in a:
		print(x, y)


(r, c, i, j) = map(int, input().split())
visit = [[0 for a in range(c)] for b in range(r)]
r -= 1
c -= 1
i -= 1
j -= 1
rama = []
visit[i][j] = 1
visit[0][j] = 1
rama.append([i + 1, j + 1])
rama.append([0 + 1, j + 1])
(a, b) = (0, -1)
while a <= r:
	if a % 2 == 0:
		b += 1
	else:
		b -= 1
	while b <= c and a % 2 == 0:
		if visit[a][b] == 0:
			rama.append([a + 1, b + 1])
		b += 1
	while b >= 0 and a % 2 == 1:
		if visit[a][b] == 0:
			rama.append([a + 1, b + 1])
		b -= 1
	a += 1
for x in rama:
	print(x[0], x[1])


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import gcd, ceil

def pre(s):
	n = len(s)
	pi = [0] * n
	for i in range(1, n):
		j = pi[i - 1]
		while j and s[i] != s[j]:
			j = pi[j - 1]
		if s[i] == s[j]:
			j += 1
		pi[i] = j
	return pi

def prod(a):
	ans = 1
	for each in a:
		ans = ans * each
	return ans

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

def binary(x, length=16):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y
for _ in range(int(input()) if not True else 1):
	(n, m, x, y) = map(int, input().split())
	if y != 1:
		ys = [i for i in range(1, m + 1) if i != 1 and i != y]
		print(x, y)
		for each in ys:
			print(x, each)
		print(x, 1)
		y = 1
	else:
		for i in range(1, m + 1):
			print(x, i)
		y = m
	xs = [i for i in range(1, n + 1) if i != x]
	for xx in xs:
		if y == 1:
			print(xx, 1, flush=True)
			while y < m:
				print(xx, y + 1)
				y += 1
		else:
			print(xx, m)
			while y > 1:
				print(xx, y - 1)
				y -= 1


l = [int(x) for x in input().split()]
n = l[0]
m = l[1]
x = l[2]
y = l[3]
ans = []
ans.append((x, y))
ans.append((1, y))
ans.append((1, 1))
visited = {}
visited[str((x, y))] = 1
visited[str((1, y))] = 1
visited[str((1, 1))] = 1
i = 1
while i != n + 1:
	if i % 2 != 0:
		for j in range(1, m + 1):
			if str((i, j)) not in visited:
				ans.append((i, j))
				visited[str((i, j))] = 1
			else:
				continue
		i += 1
	else:
		for j in range(m, 0, -1):
			if str((i, j)) not in visited:
				ans.append((i, j))
				visited[str((i, j))] = 1
			else:
				continue
		i += 1
for i in range(len(ans)):
	print(*ans[i])


(n, m, x, y) = map(int, input().split())
a = []
for i in range(n):
	a += ([0] * m,)
while x > 0:
	print(x, y)
	a[x - 1][y - 1] = 1
	x -= 1
x += 1
y -= 1
while y > 0:
	print(x, y)
	a[x - 1][y - 1] = 1
	y -= 1
y += 1
d = 1
while 1 <= x <= n:
	if a[x - 1][y - 1] == 0:
		print(x, y)
		a[x - 1][y - 1] = 1
	y += d
	if y > m:
		y -= 1
		d = -1
		x += 1
	if y < 1:
		y += 1
		x += 1
		d = 1


(rows, cols, row, col) = list(map(int, input().split()))
for i in range(col, 0, -1):
	print(row, i)
for i in range(col + 1, cols + 1):
	print(row, i)
left = False
for j in range(row - 1, 0, -1):
	if left:
		for i in range(1, cols + 1):
			print(j, i)
		left = not left
	else:
		for i in range(cols, 0, -1):
			print(j, i)
		left = not left
for j in range(row + 1, rows + 1):
	if left:
		for i in range(1, cols + 1):
			print(j, i)
		left = not left
	else:
		for i in range(cols, 0, -1):
			print(j, i)
		left = not left


(n, m, x, y) = map(int, input().split())
(a, b) = (x, y)
print(a, b)
for i in range(1, m + 1):
	if i != b:
		print(a, i)
b = m
co = 0
for i in range(1, n + 1):
	if i == x:
		continue
	if co % 2 == 0:
		for j in reversed(range(1, m + 1)):
			print(i, j)
	else:
		for j in range(1, m + 1):
			print(i, j)
	co += 1


import bisect
import copy
import fractions
import heapq
import math
import random
import sys
(n, m, S_x, S_y) = tuple(map(int, input().split()))
print(f'{S_x} {S_y}')
print(f'1 {S_y}')
for x in range(1, n + 1):
	if x % 2 == 1:
		for y in range(1, m + 1):
			if x == 1 and y == S_y or (x == S_x and y == S_y):
				continue
			print(f'{x} {y}')
	else:
		for y in range(m, 0, -1):
			if x == S_x and y == S_y:
				continue
			print(f'{x} {y}')


a = [int(x) for x in input('').split()]
n = a[0]
m = a[1]
sx = a[2]
sy = a[3]

def move(n, m, i):
	if i == -1:
		for j in range(m, 0, i):
			print(n, j)
	else:
		for k in range(1, m + 1, i):
			print(n, k)
print(sx, sy)
for m in range(1, m + 1):
	if m != sy:
		print(sx, m)
i = -1
for l in range(1, n + 1):
	if l != sx:
		move(l, m, i)
		if i == -1:
			i = 1
		else:
			i = -1


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class union_find:

	def __init__(self, n):
		self.n = n
		self.rank = [0] * n
		self.parent = [int(j) for j in range(n)]

	def union(self, i, j):
		i = self.find(i)
		j = self.find(j)
		if self.rank[i] == self.rank[j]:
			self.parent[i] = j
			self.rank[j] += 1
		elif self.rank[i] > self.rank[j]:
			self.parent[j] = i
		else:
			self.parent[i] = j

	def find(self, i):
		temp = i
		if self.parent[temp] != temp:
			self.parent[temp] = self.find(self.parent[temp])
		return self.parent[temp]
from math import log2, ceil
from collections import deque, Counter as CC

def main():
	(n, m, s, t) = [int(j) for j in input().split()]
	vis = [0 for i in range(n)]
	s -= 1
	t -= 1
	for i in range(n):
		vis[s] = 1
		print(s + 1, t + 1)
		ans = s
		for j in range(m):
			if t == j:
				continue
			ans = j
			print(s + 1, j + 1)
		t = ans
		for j in range(n):
			if vis[j] == 0:
				s = j
				break
main()


(n, m, x, y) = list(map(int, input().split()))
ii = y
print(x, y)
for c in range(1, m + 1):
	if y != c:
		print(x, c)
		ii = c
for r in range(1, n + 1):
	if x != r:
		print(r, ii)
		ij = 0
		for c in range(1, m + 1):
			if ii != c:
				print(r, c)
				ij = c
		ii = ij


(n, m, Sx, Sy) = (int(i) for i in input().split())
print(Sx, Sy)
for x in range(1, n + 1):
	if x == Sx:
		continue
	print(x, Sy)
for y in range(1, m + 1):
	if y == Sy:
		continue
	if x == 1:
		for x in range(1, n + 1):
			print(x, y)
	elif x == n:
		for x in reversed(range(1, n + 1)):
			print(x, y)
	else:
		assert False


(x, y, sx, sy) = map(int, input().split())
lastx = sx
for i in range(sy, sy + y):
	if i > y:
		i = i % y
	for j in range(lastx, lastx + x):
		if j > x:
			j = j % x
		print(j, ' ', i)
	lastx = j


import sys, math
from collections import Counter, deque, defaultdict
input = sys.stdin.readline
L = lambda : list(map(int, input().split()))
M = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input()
C = lambda : input().strip().split()
mod = 1000000007

def pl(a):
	print(' '.join(list(map(str, a))))

def inc(n, m):
	for i in range(1, m + 1):
		print(n, i)

def dec(n, m):
	for i in range(m, 0, -1):
		print(n, i)

def solve():
	(n, m, a, b) = M()
	print(a, b)
	for i in range(1, m + 1):
		if i != b:
			print(a, i)
	for i in range(n - 1):
		a += 1
		if a > n:
			a = 1
		if i % 2:
			inc(a, m)
		else:
			dec(a, m)
for _ in range(1):
	solve()


(n, m, x, y) = map(int, input().split())
ans = [[x, y], [1, y]]
for i in range(1, n + 1):
	if i % 2 == 1:
		for j in range(1, m + 1):
			if (i, j) in [(x, y), (1, y)]:
				continue
			ans.append([i, j])
	else:
		for j in range(m, 0, -1):
			if (i, j) in [(x, y), (1, y)]:
				continue
			ans.append([i, j])
for a in ans:
	print(*a)


from collections import deque
from collections import OrderedDict
import math
import sys
import os
import threading
import bisect
import operator
import heapq
from atexit import register
from io import BytesIO
import io
input = lambda : sys.stdin.readline().rstrip('\r\n')
(n, m, Sx, Sy) = map(int, input().split())
print(Sx, Sy)
for i in range(Sx, 0, -1):
	print(i, 1)
for i in range(Sx + 1, n + 1):
	print(i, 1)
flag = n
for j in range(2, m + 1):
	if flag == n:
		for i in range(n, 0, -1):
			if not (i == Sx and j == Sy):
				print(i, j)
		flag = 1
	else:
		for i in range(1, n + 1, 1):
			if not (i == Sx and j == Sy):
				print(i, j)
		flag = n


(n, m, x, y) = [int(i) for i in input().split()]
ans = []
x = x - 1
y = y - 1
down = n - 1 - x
up = n - 1
d = [[-1 for i in range(m)] for i in range(n)]
done = []
pos = y
while n > 0:
	if -1 in d[x]:
		n -= 1
		d[x][pos] = 0
		ans.append((x + 1, pos + 1))
	while -1 in d[x]:
		pos = d[x].index(-1)
		ans.append((x + 1, pos + 1))
		d[x][pos] = 0
	if down > 0:
		x = x + 1
		down -= 1
	elif up > 0:
		x = x - 1
		up -= 1
for i in ans:
	print(i[0], i[1])


from functools import lru_cache
from sys import stdin, stdout
import sys
for __ in range(1):
	(n, m, x, y) = map(int, input().split())
	print(x, y)
	for i in range(2, m + 1):
		if i != y:
			print(x, i)
	a = 1
	f = 1
	print(x, 1)
	while a < x:
		if f == 1:
			for i in range(1, m + 1):
				print(a, i)
			f = 0
			a += 1
		else:
			for i in range(m, 0, -1):
				print(a, i)
			f = 1
			a += 1
	a = x + 1
	while a <= n:
		if f == 1:
			for i in range(1, m + 1):
				print(a, i)
			f = 0
			a += 1
		else:
			for i in range(m, 0, -1):
				print(a, i)
			f = 1
			a += 1


from math import *
t = 1
while t:
	t = t - 1
	(n, m, x, y) = map(int, input().split())
	print(x, y)
	xi = x
	xy = y - 1
	c = -1
	for i in range(x, 0, -1):
		if c == -1:
			for j in range(y, 0, -1):
				if i != x or j != y:
					print(i, j)
		else:
			for j in range(1, y + 1):
				if i != x or j != y:
					print(i, j)
		c *= -1
		xi = i
	for i in range(1, n + 1):
		if c == -1:
			for j in range(m, y, -1):
				if i != x or j != y:
					print(i, j)
		else:
			for j in range(y + 1, m + 1):
				if i != x or j != y:
					print(i, j)
		c *= -1
	for i in range(n, x, -1):
		if c == -1:
			for j in range(y, 0, -1):
				if i != x or j != y:
					print(i, j)
		else:
			for j in range(1, y + 1):
				if i != x or j != y:
					print(i, j)
		c *= -1


from sys import stdin, stdout
import heapq
import cProfile
from collections import Counter, defaultdict, deque
from functools import reduce
import math

def get_int():
	return int(stdin.readline().strip())

def get_tuple():
	return map(int, stdin.readline().split())

def get_list():
	return list(map(int, stdin.readline().split()))

def solve():
	(n, m, x, y) = get_tuple()
	ans = []
	r = x
	cnt_r = 0
	c = y
	while cnt_r < n:
		cnt_c = 0
		while cnt_c < m:
			ans.append([r, c])
			cnt_c += 1
			c += 1
			if c == m + 1:
				c = 1
		c -= 1
		if c == 0:
			c = m
		cnt_r += 1
		r += 1
		if r == n + 1:
			r = 1
	for val in ans:
		print(*val)

def main():
	solve()
TestCases = False
if TestCases:
	for i in range(get_int()):
		main()
else:
	main()


import sys
input = sys.stdin.readline
(inp, ip) = (lambda : int(input()), lambda : [int(w) for w in input().split()])
(n, m, x, y) = ip()
a = [(x, y), (1, y), (1, 1)]
dt = {0: range(m, 0, -1), 1: range(1, m + 1)}
for i in range(1, n + 1):
	for j in dt[i % 2]:
		if (i, j) not in a:
			a.append((i, j))
for i in a:
	print(*i)


(n, m, sx, sy) = map(int, input().split())
sx -= 1
sy -= 1
if sx != 0 and sx != n - 1:
	for i in range(sy, -1, -1):
		print(sx + 1, i + 1)
	for i in range(sy + 1, m):
		print(sx + 1, i + 1)
	if sy == m - 1:
		print(sx + 1, sy + 1)
	flag = 1
	x = 0
	while x < sx:
		if flag:
			for i in range(m - 1, -1, -1):
				print(x + 1, i + 1)
			flag = 0
			x += 1
		else:
			for i in range(m):
				print(x + 1, i + 1)
			flag = 1
			x += 1
	x += 1
	while x < n:
		if flag:
			for i in range(m - 1, -1, -1):
				print(x + 1, i + 1)
			flag = 0
			x += 1
		else:
			for i in range(m):
				print(x + 1, i + 1)
			flag = 1
			x += 1
elif sx == n - 1:
	for i in range(sy, -1, -1):
		print(sx + 1, i + 1)
	for i in range(sy + 1, m):
		print(sx + 1, i + 1)
	if sy == m - 1:
		print(sx + 1, sy + 1)
	x = 0
	flag = 1
	while x < n - 1:
		if flag:
			for i in range(m - 1, -1, -1):
				print(x + 1, i + 1)
			flag = 0
			x += 1
		else:
			for i in range(m):
				print(x + 1, i + 1)
			flag = 1
			x += 1
else:
	for i in range(sy, -1, -1):
		print(sx + 1, i + 1)
	for i in range(sy + 1, m):
		print(sx + 1, i + 1)
	if sy == m - 1:
		print(sx + 1, sy + 1)
	x = 1
	flag = 1
	while x < n:
		if flag:
			for i in range(m - 1, -1, -1):
				print(x + 1, i + 1)
			flag = 0
			x += 1
		else:
			for i in range(m):
				print(x + 1, i + 1)
			flag = 1
			x += 1


(n, m, sx, sy) = list(map(int, input().split()))
visited = {(sx, sy), (1, sy)}
print(sx, sy)
print(1, sy)
print(1, 1)
i = 1
j = 2
direction = 1
while i <= n:
	if (i, j) not in visited:
		print(i, j)
	if j == 1 or j == m:
		direction = -direction
		i += 1
		if i > n:
			break
		if (i, j) not in visited:
			print(i, j)
	j += direction


def walk_str(lst):
	(m, n, x, y) = lst
	print(x, y)
	for i in range(m):
		if i + 1 != x:
			reply = i + 1
			print(reply, y)
	return reply
(m, n, x, y) = input().split()
m = int(m)
n = int(n)
x = int(x)
y = int(y)
for i in range(n):
	x = walk_str([m, n, x, y])
	if y < n:
		y += 1
	else:
		y = 1


from math import *
from collections import *
from random import *
from decimal import Decimal
from heapq import *
from bisect import *
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 5)

def lis():
	return list(map(int, input().split()))

def ma():
	return map(int, input().split())

def inp():
	return int(input())

def st():
	return input().rstrip('\n')
t = 1
while t:
	t -= 1
	(n, m, sx, sy) = ma()
	vis = [[0 for i in range(m)] for j in range(n)]
	vis[sx - 1][sy - 1] = 1
	print(sx, sy)
	while sy != m:
		print(sx, sy + 1)
		sy += 1
		vis[sx - 1][sy - 1] = 1
	for i in range(m):
		for j in range(n):
			if i == 0:
				if vis[j][m - i - 1] == 1:
					continue
				print(j + 1, m - i)
				vis[j][m - i - 1] = 1
			if i % 2:
				if vis[n - j - 1][m - i - 1] == 1:
					continue
				print(n - j, m - i)
				vis[n - j - 1][m - i - 1] = 1
			else:
				if vis[j][m - i - 1] == 1:
					continue
				print(j + 1, m - i)
				vis[j][m - i - 1] = 1


(n, m, x, y) = map(int, input().split())
visited = [[False] * (m + 10) for _ in range(n + 10)]
cnt = 0
print(x, y)
visited[x][y] = True
cnt += 1
while x != 1:
	x -= 1
	print(x, y)
	visited[x][y] = True
	cnt += 1
while y != 1:
	y -= 1
	print(x, y)
	visited[x][y] = True
	cnt += 1
d = 1
while cnt < n * m:
	if d == 1 and y < m:
		y += 1
		if not visited[x][y]:
			print(x, y)
			visited[x][y] = True
			cnt += 1
	elif d == 1 and y == m:
		x += 1
		d *= -1
		if not visited[x][y]:
			print(x, y)
			visited[x][y] = True
			cnt += 1
	elif d == -1 and 1 < y:
		y -= 1
		if not visited[x][y]:
			print(x, y)
			visited[x][y] = True
			cnt += 1
	elif d == -1 and y == 1:
		x += 1
		d *= -1
		if not visited[x][y]:
			print(x, y)
			visited[x][y] = True
			cnt += 1


l = list(map(int, input().split()))
n = l[0]
m = l[1]
a = l[2]
b = l[3]
print(a, b)
for i in range(2, b):
	print(a, i)
for i in range(b + 1, m + 1):
	print(a, i)
print(a, 1)
for i in range(1, a):
	if i % 2 == 1:
		for j in range(1, m + 1):
			print(i, j)
	else:
		for j in range(m, 0, -1):
			print(i, j)
for i in range(a + 1, n + 1):
	if i % 2 == 0:
		for j in range(1, m + 1):
			print(i, j)
	else:
		for j in range(m, 0, -1):
			print(i, j)


import sys
input = sys.stdin.readline
(n, m, x, y) = map(int, input().split())
(x, y) = (x - 1, y - 1)
for i in range(m):
	for j in range(n):
		print(x + 1, y + 1)
		x = (x + 1) % n
	x = (x - 1) % n
	y = (y + 1) % m


(n, m, x, y) = list(map(lambda x: int(x), input().split()))
visited = set()
print(x, y)
if y != m:
	for i in range(0, n):
		if i + 1 != x:
			print(i + 1, y)
	btt = False
	lst = []
	for i in range(m - y):
		if btt:
			for j in range(n):
				lst.append((j + 1, y + i + 1))
		else:
			for j in range(n - 1, -1, -1):
				lst.append((j + 1, y + i + 1))
		btt = not btt
	if (x, y) != (1, 1):
		if (m - y) % 2 == 0:
			btt = False
			for i in range(y - 1):
				if btt:
					for j in range(n):
						lst.append((j + 1, i + 1))
				else:
					for j in range(n - 1, -1, -1):
						lst.append((j + 1, i + 1))
				btt = not btt
		else:
			btt = True
			for i in range(y - 1):
				if btt:
					for j in range(n):
						lst.append((j + 1, i + 1))
				else:
					for j in range(n - 1, -1, -1):
						lst.append((j + 1, i + 1))
				btt = not btt
else:
	for i in range(n - 1, -1, -1):
		if i + 1 != x:
			print(i + 1, y)
	btt = True
	lst = []
	for i in range(m - y):
		if btt:
			for j in range(n):
				lst.append((j + 1, y + i + 1))
		else:
			for j in range(n - 1, -1, -1):
				lst.append((j + 1, y + i + 1))
		btt = not btt
	if (x, y) != (1, 1):
		if (m - y) % 2 == 0:
			btt = True
			for i in range(y - 1):
				if btt:
					for j in range(n):
						lst.append((j + 1, i + 1))
				else:
					for j in range(n - 1, -1, -1):
						lst.append((j + 1, i + 1))
				btt = not btt
		else:
			btt = False
			for i in range(y - 1):
				if btt:
					for j in range(n):
						lst.append((j + 1, i + 1))
				else:
					for j in range(n - 1, -1, -1):
						lst.append((j + 1, i + 1))
				btt = not btt
for i in lst:
	print(i[0], i[1])


(n, m, x, y) = map(int, input().split())
print(x, y)

def lin(x, y):
	for i in range(1, m + 1):
		if not i == y:
			print(x, i)
			t = i
	return t
y = lin(x, y)
for j in range(1, n + 1):
	if not j == x:
		print(j, y)
		y = lin(j, y)


from sys import stdin
inp = lambda : stdin.readline().strip()
(n, m, x, y) = [int(x) for x in inp().split()]
print(x, y)
h = y
v = x
for i in range(m - y):
	h += 1
	print(v, h)
h = y
for i in range(y - 1):
	h -= 1
	print(v, h)
cond = True
for i in range(x - 1):
	v -= 1
	if cond:
		h = 1
	else:
		h = m
	for j in range(m):
		print(v, h)
		if cond:
			h += 1
		else:
			h -= 1
	cond = not cond
v = x
for i in range(n - x):
	v += 1
	if cond:
		h = 1
	else:
		h = m
	for j in range(m):
		print(v, h)
		if cond:
			h += 1
		else:
			h -= 1
	cond = not cond


def print_hi(name):
	print(f'Hi, {name}')

def move_column():
	pass

def move_row():
	pass
val = input()
inputs = val.split(' ')
(n, m, Sx, Sy) = (int(inputs[0]), int(inputs[1]), int(inputs[2]), int(inputs[3]))
print(Sx, '', Sy)
dir = True
for i in range(0, n):
	if i != Sx - 1:
		print(i + 1, '', Sy)
for i in range(0, m):
	if i == Sy - 1:
		continue
	if dir:
		for j in reversed(range(0, n)):
			print(j + 1, '', i + 1)
		dir = False
	else:
		for j in range(0, n):
			print(j + 1, '', i + 1)
		dir = True


(n, m, Sx, Sy) = [int(x) for x in input().split(' ')]
print(Sx, Sy)
special_visits = {(Sx, Sy)}
(row, col) = (Sx, Sy)
col = 1
print(row, col)
special_visits.add((row, col))
row = 1
dir = 1
while col <= m:
	while row <= n and row > 0:
		if (row, col) not in special_visits:
			print(row, col)
		row += dir
	col += 1
	row -= dir
	dir *= -1


(n, m, x, y) = [int(i) for i in input().split()]
row = [0] * n
row[x] == 1
curr = x
print(x, y)
rev = 0
for i in range(n):
	for j in range(m):
		if curr == x and j == y - 1:
			continue
		if rev == 0:
			print(curr, j + 1)
		else:
			print(curr, m - j)
	if curr == n:
		curr = 1
	else:
		curr += 1
	if rev == 0:
		rev = 1
	else:
		rev = 0


def print_column(x1, y1):
	global last
	print(x1, y1)
	a = y1 - 1
	k = 0
	while a > 0:
		print(x1, a)
		a -= 1
		k = a + 1
	a = y1 + 1
	while a <= m:
		print(x1, a)
		a += 1
		k = a - 1
	last = k
	return last

def print_marixup(x, y):
	if 1 <= x <= n:
		j = print_column(x, y)
		print_marixup(x - 1, j)

def print_matrixdwn(x, y):
	if 1 <= x <= n:
		j = print_column(x, y)
		print_matrixdwn(x + 1, j)
(n, m, x, y) = map(int, input().split())
sums = 0
last = x
print_marixup(x, y)
print_matrixdwn(x + 1, last)


(n, m, sx, sy) = map(int, input().split())
ans = []
if 1 == 1:
	for i in range(sx, 1, -2):
		for j in range(sy, m + 1):
			ans.append((i, j))
		for j in range(m, sy - 1, -1):
			ans.append((i - 1, j))
	if sx % 2 == 1:
		for j in range(sy, m + 1):
			ans.append((1, j))
	if sx % 2 == 0:
		for i in range(1, sx, 2):
			for j in range(1, sy):
				ans.append((i, j))
			for j in range(sy - 1, 0, -1):
				ans.append((i + 1, j))
	else:
		for i in range(1, sx, 2):
			for j in range(sy - 1, 0, -1):
				ans.append((i, j))
			for j in range(1, sy):
				ans.append((i + 1, j))
		for j in range(sy - 1, 0, -1):
			ans.append((sx, j))
	for i in range(sx + 1, n, 2):
		for j in range(1, m + 1):
			ans.append((i, j))
		for j in range(m, 0, -1):
			ans.append((i + 1, j))
	if (n - sx) % 2 == 1:
		for j in range(1, m + 1):
			ans.append((n, j))
	for a in ans:
		print(a[0], a[1])


(n, m, sx, sy) = map(int, input().split())
print(sx, sy)
x = sx
y = 1
for i in range(m):
	if y != sy:
		print(x, y)
	y += 1
x = 1
y = m
p = 0
print(x, y)
for i in range(n - 1):
	y = 1
	if p == 0:
		print(x, y)
		for i in range(m - 2):
			y += 1
			print(x, y)
		if x + 1 == sx:
			x = sx + 1
			if x > n:
				break
			print(x, m - 1)
			p = 1
		else:
			x = x + 1
			if x > n:
				break
			print(x, m - 1)
			p = 1
	else:
		print(x, y)
		for i in range(m - 3):
			y += 1
			print(x, y)
		print(x, m)
		if x + 1 == sx:
			x = sx + 1
			if x > n:
				break
			print(x, m)
			p = 0
		else:
			x = x + 1
			if x > n:
				break
			print(x, m)
			p = 0


from sys import stdin, stdout

class SOLVE:

	def solve(self):
		R = input
		W = stdout.write
		(n, m, x, y) = [int(x) for x in R().split()]
		ans = [str(x) + ' ' + str(y), '\n', '1' + ' ' + str(y), '\n']
		direction = 'forward'
		for i in range(1, n + 1):
			if direction == 'forward':
				for j in range(1, m + 1):
					if (i, j) != (x, y) and (i, j) != (1, y):
						ans += [str(i) + ' ' + str(j), '\n']
				direction = 'backward'
			else:
				for j in range(m, 0, -1):
					if (i, j) != (x, y) and (i, j) != (1, y):
						ans += [str(i) + ' ' + str(j), '\n']
				direction = 'forward'
		W(''.join(ans))

def main():
	s = SOLVE()
	s.solve()
main()


import os
import sys
from io import BytesIO, IOBase
import math

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
import os
import sys
from io import BytesIO, IOBase

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
(n, m, x, y) = map(int, input().split())
vc = []
ans = []
ans.append([x, y])
for i in range(0, n):
	if i + 1 != x:
		ans.append([i + 1, y])
		sp = i + 1
for i in range(0, m):
	if i + 1 != y:
		if sp == n:
			for j in range(n - 1, -1, -1):
				ans.append([j + 1, i + 1])
				sp = j + 1
		else:
			for j in range(0, n):
				ans.append([j + 1, i + 1])
				sp = j + 1
for i in ans:
	print(*i)


import sys
read = sys.stdin.readline
(m, n, x, y) = map(int, read().split())
b = [[0] * n for _ in range(m)]
(x, y) = (x - 1, y - 1)
count = 1
b[x][y] = count
count += 1
print(x + 1, y + 1)
x = 0
b[x][y] = count
count += 1
print(x + 1, y + 1)
y = 0
b[x][y] = count
count += 1
print(x + 1, y + 1)
step = 1
while (x != m - 1 or y != n - 1) or (x != m - 1 or y != 0):
	if y + step >= n or y + step < 0:
		x += 1
		if x > m - 1:
			break
		b[x][y] = count
		count += 1
		print(x + 1, y + 1)
		step *= -1
	y += step
	if b[x][y] != 0:
		y += step
	b[x][y] = count
	count += 1
	print(x + 1, y + 1)


(n, m, x, y) = map(int, input().split())
ans = []
ans.append([x, y])
c = 1
for i in range(2, x):
	ans.append([i, y])
for i in range(x + 1, n + 1):
	ans.append([i, y])
for i in range(y + 1, m + 1):
	if c:
		for j in range(n, 1, -1):
			ans.append([j, i])
		c ^= 1
	else:
		for j in range(2, n + 1):
			ans.append([j, i])
		c ^= 1
for i in range(m, max(1, y - 1), -1):
	ans.append([1, i])
c = 0
for i in range(y - 1, 0, -1):
	if c:
		for j in range(n, 0, -1):
			ans.append([j, i])
		c ^= 1
	else:
		for j in range(1, n + 1):
			ans.append([j, i])
		c ^= 1
for i in ans:
	print(*i)


(n, m, sx, sy) = map(int, input().split())
(x, y) = (sx, sy)
for r in range(n):
	for c in range(m):
		print(x, y)
		y = 1 if y == m else y + 1
	y = m if y == 1 else y - 1
	x = 1 if x == n else x + 1


(n, m, x, y) = [int(ele) for ele in input().split()]
(sx, sy) = (x, y)
i = x
for j in range(y, 0, -1):
	print(i, j, end=' ')
	print('')
for j in range(y + 1, m + 1):
	print(i, j, end=' ')
	print('')
x = x - 1
dy = 0
flip = False
while x > 0:
	if flip:
		for j in range(1, m + 1):
			print(x, j, end=' ')
			print('')
			if x - 1 == 0:
				dy = j
	else:
		for j in range(m, 0, -1):
			print(x, j, end=' ')
			print('')
			if x - 1 == 0:
				dy = j
	x = x - 1
	flip = True if flip == False else False
x = sx + 1
flip = False if dy == m else True
while x <= n:
	if flip:
		for j in range(1, m + 1):
			print(x, j, end=' ')
			print('')
	else:
		for j in range(m, 0, -1):
			print(x, j, end=' ')
			print('')
	x = x + 1
	flip = True if flip == False else False


def solve():
	(n, m, sx, sy) = [int(v) for v in input().split()]
	sol = [(sx, sy)]
	visited = set()
	visited.add(sol[0])
	if (sx, m) not in visited:
		sol.append((sx, m))
		visited.add(sol[-1])
	if (1, m) not in visited:
		sol.append((1, m))
		visited.add(sol[-1])
	godown = True
	colidx = m
	rowidx = 1
	while colidx > 0:
		while godown and rowidx < n or (not godown and rowidx > 1):
			if godown:
				rowidx += 1
			else:
				rowidx -= 1
			if (rowidx, colidx) not in visited:
				sol.append((rowidx, colidx))
				visited.add(sol[-1])
		colidx -= 1
		godown = not godown
		if colidx > 0:
			sol.append((rowidx, colidx))
			visited.add(sol[-1])
	for (x, y) in sol:
		print(x, y)
solve()


(n, m, x, y) = map(int, input().strip().split(' '))
ans = []
p = 0
visited = [[False for i in range(m + 1)] for j in range(n + 1)]
ans.append([x, y])
visited[x][y] = True
x = 1
ans.append([x, y])
visited[x][y] = True
y = 1
ans.append([x, y])
visited[x][y] = True
for f in range(n):
	if f % 2 == 0:
		while y <= m:
			if not visited[x][y]:
				ans.append([x, y])
			y += 1
		y -= 1
	else:
		while y >= 1:
			if not visited[x][y]:
				ans.append([x, y])
			y -= 1
		y += 1
	x += 1
for (a, b) in ans:
	print(a, b)


a = input().split(' ')
x = int(a[0])
y = int(a[1])
tag = int(a[2])
tag1 = int(a[3])
nowx = tag
nowy = tag1
dict = {}
while len(dict) != x * y:
	for i in range(y):
		if (nowy + i) % y == 0:
			print(nowx, y)
		else:
			print(nowx, (nowy + i) % y)
		dict[str([nowx, nowy])] = 0
	nowy = nowy - 1
	if nowy < 0:
		nowy = y - 1
	nowx += 1
	if nowx > x:
		nowx = 1
	if nowx == tag:
		break


import math, sys, bisect, heapq
from collections import defaultdict, Counter, deque
from itertools import groupby, accumulate
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
ilele = lambda : map(int, input().split())
alele = lambda : list(map(int, input().split()))

def list2d(a, b, c):
	return [[c] * b for i in range(a)]
MOD = 1000000000 + 7
(n, m, x, y) = ilele()
print(x, y)
last = y
for j in range(1, m + 1):
	if j != y:
		print(x, j)
		last = j
zz = last
for i in range(1, n + 1):
	if i != x:
		print(i, zz)
		for j in range(1, m + 1):
			if j != zz:
				print(i, j)
				last = j
		zz = last


(row, column, ii, jj) = map(int, input().split())
a = [[0 for i in range(column)] for j in range(row)]
a[ii - 1][jj - 1] = 1
print(ii, jj)
a[0][jj - 1] = 1
print(1, jj)
a[0][0] = 1
print(1, 1)
for i in range(0, row):
	if i % 2 != 0:
		k = column - 1
	for j in range(0, column):
		if i % 2 != 0:
			if a[i][k - j] == 0:
				print(i + 1, k - j + 1)
				a[i][k - j] = 1
		elif a[i][j] == 0:
			print(i + 1, j + 1)
			a[i][j] = 1


(n, m, sx, sy) = map(int, input().split())
matrix = []
result = []
for i in range(n):
	new = []
	for i in range(m):
		new.append(0)
	matrix.append(new)
matrix[sx - 1][sy - 1] = 1
flag = 1

def row(sx, sy, n, m):
	global flag
	for i in range(n):
		if matrix[i][sy] == 0:
			matrix[i][sy] = 1
			if i == n - 1:
				flag *= -1
			return i + 1
	return -1

def column(sx, sy, n, m):
	global flag
	for i in range(m):
		if matrix[sx][i] == 0:
			matrix[sx][i] = 1
			if i == m - 1:
				flag *= -1
			return i + 1
	return -1
count = n * m - 1
result.append([sx, sy])
while count > 0:
	if n * m == 1:
		break
	if flag == 1:
		temp = row(sx - 1, sy - 1, n, m)
		if temp != -1:
			sx = temp
		else:
			flag *= -1
			continue
	elif flag == -1:
		temp = column(sx - 1, sy - 1, n, m)
		if temp != -1:
			sy = temp
		else:
			flag *= -1
			continue
	count -= 1
	result.append([sx, sy])
for i in result:
	for ele in i:
		print(ele, end=' ')
	print()


(n, m, x, y) = map(int, input().split())
if n > m:
	(n, m) = (m, n)
	(x, y) = (y, x)
	reverse_flag = True
else:
	reverse_flag = False
flist = [[m * i + j + 1 for j in range(0, m)] for i in range(0, n)]
(flist[0][0], flist[0][y - 1]) = (flist[0][y - 1], flist[0][0])
res = [[]] * n
res[x - 1] = flist[0]
(index, current) = (1, flist[0].index(m))
flag = set(list(range(0, m)))
flag.remove(current)
for (res_index, val) in enumerate(res):
	if len(val):
		continue
	(flist[index][0], flist[index][current]) = (flist[index][current], flist[index][0])
	tmp = flag.pop()
	lm = flist[index].index(max(flist[index]))
	(flist[index][tmp], flist[index][lm]) = (flist[index][lm], flist[index][tmp])
	current = tmp
	res[res_index] = flist[index]
	index += 1
res_list = []
for (i, info) in enumerate(res):
	for (j, v) in enumerate(info):
		tmp = [i + 1, j + 1] if not reverse_flag else [j + 1, i + 1]
		res_list.append([v, tmp])
res_list.sort()
for (index, position) in res_list:
	print(position[0], position[1])


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase

def main():

	def visit(row, column):
		visited[row][column] = 1
		print(row + 1, column + 1)
		position[0] = row
		position[1] = column
	(n, m, startRow, startColumn) = map(lambda x: int(x), input().split())
	startRow -= 1
	startColumn -= 1
	visited = [[0] * m for i in range(n)]
	position = [startRow, startColumn]
	visit(startRow, startColumn)
	visit(startRow, 0)
	visit(0, 0)
	deltaRow = 1
	for i in range(n * m - 3):
		while visited[position[0]][position[1]]:
			if deltaRow > 0:
				if position[0] < n - 1:
					position[0] += deltaRow
				else:
					position[1] += 1
					deltaRow = -1
			elif position[0] > 0:
				position[0] += deltaRow
			else:
				position[1] += 1
				deltaRow = 1
		visit(*position)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
input = lambda : sys.stdin.readline().rstrip('\r\n')

def print(*args, **kwargs):
	sep = kwargs.pop('sep', ' ')
	file = kwargs.pop('file', sys.stdout)
	atStart = True
	for x in args:
		if not atStart:
			file.write(sep)
		file.write(str(x))
		atStart = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
main()


(a, b, x, y) = map(int, input().split())
grid = [[0 for n in range(b + 1)] for n in range(a + 1)]
print(x, y)
grid[x][y] = 1
while 1:
	pos = 0
	for n in range(1, a + 1):
		if grid[n][y] == 0:
			pos = 1
			print(n, y)
			grid[n][y] = 1
			x = n
			break
	if pos:
		continue
	for n in range(1, b + 1):
		if grid[x][n] == 0:
			grid[x][n] = 1
			print(x, n)
			y = n
			pos = 1
			break
	if pos == 0:
		break


(a, b, c, d) = map(int, input().split())
print(c, d)
print(1, d)
for i in range(1, a + 1):
	if i & 1:
		for j in range(1, b + 1):
			if (i == c or i == 1) and j == d:
				continue
			else:
				print(i, j)
	else:
		for j in reversed(range(1, b + 1)):
			if (i == c or i == 1) and j == d:
				continue
			else:
				print(i, j)


import sys, threading
sys.setrecursionlimit(10 ** 8)
threading.stack_size(10 ** 8)

def main():
	(n, m, si, sj) = map(int, input().split())
	print(si, sj)
	print(1, sj)
	for i in range(0, n):
		for j in range(0, m) if i % 2 == 0 else reversed(range(0, m)):
			if (i, j) not in [(si - 1, sj - 1), (0, sj - 1)]:
				print(i + 1, j + 1)
threading.Thread(target=main).start()


import sys
import math
from functools import reduce
import bisect

def getN():
	return int(input())

def getNM():
	return map(int, input().split())

def getList():
	return list(map(int, input().split()))

def input():
	return sys.stdin.readline().rstrip()

def index(a, x):
	i = bisect.bisect_left(a, x)
	if i != len(a) and a[i] == x:
		return i
	return False
(n, m, x, y) = getNM()
steps = []
for i in range(x, n + 1):
	steps.append((i, y))
for i in range(x - 1, 0, -1):
	steps.append((i, y))
up = True
for i in range(y + 1, m + 1):
	if up:
		for j in range(1, n + 1):
			steps.append((j, i))
		up = False
	else:
		for j in range(n, 0, -1):
			steps.append((j, i))
		up = True
for i in range(y - 1, 0, -1):
	if up:
		for j in range(1, n + 1):
			steps.append((j, i))
		up = False
	else:
		for j in range(n, 0, -1):
			steps.append((j, i))
		up = True
for step in steps:
	print(step[0], step[1])


(n, m, r, c) = map(int, input().split())
r -= 1
c -= 1
init = [r, c]
print(r + 1, c + 1)
for j in range(c + 1, m):
	print(r + 1, j + 1)
for j in range(c - 1, -1, -1):
	print(r + 1, j + 1)
lr = True
r += 1
while r < n:
	if lr:
		for j in range(m):
			print(r + 1, j + 1)
	else:
		for j in range(m - 1, -1, -1):
			print(r + 1, j + 1)
	lr = not lr
	r += 1
r = init[0] - 1
while r >= 0:
	if lr:
		for j in range(m):
			print(r + 1, j + 1)
	else:
		for j in range(m - 1, -1, -1):
			print(r + 1, j + 1)
	lr = not lr
	r -= 1


(rows, cols, sx, sy) = map(int, input().split())
start_pos = [sx, sy]

def go_up_total(cur_pos: list):
	cur_pos[0] = 1
	my_print(cur_pos)

def go_down(cur_pos: list):
	if cur_pos[0] < rows:
		cur_pos[0] += 1
		my_print(cur_pos)

def my_print(cur_pos: list):
	if not (cur_pos[0] == sx and cur_pos[1] == sy):
		print(cur_pos[0], end=' ')
		print(cur_pos[1])

def fill_row(cur_pos: list):
	first_col = cur_pos[1]
	while cur_pos[1] is not cols:
		cur_pos[1] += 1
		my_print(cur_pos)
	if first_col > 1:
		cur_pos[1] = first_col
		while cur_pos[1] is not 1:
			cur_pos[1] -= 1
			my_print(cur_pos)
print(sx, end=' ')
print(sy)
cur_pos = [sx, sy]
go_up_total(cur_pos)
for i in range(rows):
	fill_row(cur_pos)
	go_down(cur_pos)


(n, m, sx, sy) = map(int, input().split())
route = [(sx - 1, sy - 1), (0, sy - 1), (0, 0)]
(i, j) = (0, 0)
dir = 1
while True:
	j += dir
	if (i, j) != (0, sy - 1) and (i, j) != (sx - 1, sy - 1):
		route.append((i, j))
	if j == 0 or j == m - 1:
		dir *= -1
		i += 1
		route.append((i, j))
	if i != n:
		continue
	if n % 2 == 0 and j == 0:
		break
	if n % 2 != 0 and j == m - 1:
		break
for r in route[:len(route) - 1]:
	print(r[0] + 1, r[1] + 1)


(n, m, sx, sy) = map(int, input().split())
i = 0
import copy
a = copy.deepcopy(sx)
b = copy.deepcopy(sy)
print(a, b)
while a > 1:
	a -= 1
	print(a, b)
	i += 1
a = copy.deepcopy(sx)
while a < n:
	a += 1
	print(a, b)
	i += 1
b += 1
while b <= m:
	if a == 1:
		while a <= n:
			print(a, b)
			a += 1
			i += 1
		a -= 1
		b += 1
	if b > m:
		break
	if a == n:
		while a >= 1:
			print(a, b)
			a -= 1
			i += 1
		a += 1
		b += 1
	if b > m:
		break
b = 1
while b < sy:
	if a == 1:
		while a <= n:
			print(a, b)
			a += 1
			i += 1
		a -= 1
		b += 1
	if b > m or b == sy:
		break
	if a == n:
		while a >= 1:
			print(a, b)
			a -= 1
			i += 1
		a += 1
		b += 1
	if b > m:
		break


(n, m, x, y) = map(int, input().split())
print(x, y)
f = 0
f1 = 0
f2 = 0
for i in range(x):
	if f == 0:
		for j in range(1, y):
			f = x - i
			d = j
			print(x - i, j)
		for j in range(m - y + 1):
			f = x - i
			d = j + y
			if x - i == x and y + j == y:
				continue
			else:
				print(x - i, y + j)
		f = 1
	elif f1 == 0:
		for j in range(m, 0, -1):
			print(x - i, j)
			f1 = 1
	else:
		for j in range(1, m + 1):
			print(x - i, j)
		f1 = 0
for i in range(1, n - x + 1):
	if f == 0:
		for j in range(1, y):
			f = x + i
			d = j
			print(x + i, j)
		for j in range(m - y + 1):
			f = x + i
			d = j + y
			if x + i == x and y + j == y:
				continue
			else:
				print(x + i, y + j)
		f = 1
	elif f1 == 0:
		for j in range(m, 0, -1):
			print(x + i, j)
			f1 = 1
	else:
		for j in range(1, m + 1):
			print(x + i, j)
		f1 = 0


(n, m, sx, sy) = map(int, input().split())
moves = [(sx, sy)]
if sx != 1:
	moves.append((1, sy))
for i in range(1, m + 1):
	if i != sy:
		moves.append((1, i))
switch = 1
for row in range(2, n + 1):
	if switch == 1:
		for col in range(m, 0, -1):
			if (row, col) == (sx, sy):
				continue
			moves.append((row, col))
	else:
		for col in range(1, m + 1):
			if (row, col) == (sx, sy):
				continue
			moves.append((row, col))
	switch = 1 - switch
for move in moves:
	print(move[0], move[1])


import sys
import heapq, functools, collections
import math, random
from collections import Counter, defaultdict

def solve(h, w, x, y):
	console('----- solving ------')
	(x, y) = (x - 1, y - 1)
	for _ in range(h):
		for _ in range(w):
			print('{} {}'.format(x + 1, y + 1))
			y = (y + 1) % w
		y = (y - 1) % w
		x = (x + 1) % h
	return

def console(*args):
	print('\x1b[36m', *args, '\x1b[0m', file=sys.stderr)
	return
(h, w, x, y) = list(map(int, input().split()))
solve(h, w, x, y)


import os
import sys
from io import BytesIO, IOBase
import math
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
(n, m, sx, sy) = [int(x) for x in input().split()]
sx -= 1
sy -= 1
nl = list()
kk = [(sx, sy)]
tx = sx
ty = sy
nl.append(n)
p = n * m
i = 1
j = 1
ccc = 1
bb = len(kk)
while len(kk) < p:
	if j < m:
		ty = (ty + 1) % m
		j += 1
	else:
		tx = (tx + 1) % n
		j = 1
	if (tx, ty) not in kk:
		kk.append((tx, ty))
for i in kk:
	print(i[0] + ccc, i[1] + ccc)


from collections import defaultdict
(n, m, x, y) = map(int, input().split())
visited = dict()
visited = defaultdict(lambda : False, visited)
print(x, y)
visited[x, y] = True
while x > 1:
	if not visited[x - 1, y]:
		print(x - 1, y)
		visited[x - 1, y] = True
		x -= 1
while y > 1:
	if not visited[x, y - 1]:
		print(x, y - 1)
		visited[x, y - 1] = True
		y -= 1
for i in range(1, n + 1):
	if i % 2 == 1:
		for j in range(1, m + 1):
			if not visited[i, j]:
				print(i, j)
				visited[i, j] = True
	else:
		for j in range(m, 0, -1):
			if not visited[i, j]:
				print(i, j)
				visited[i, j] = True


import io, os
from collections import deque
import bisect
from collections import deque
RL = lambda : list(map(int, input().split(' ')))
(n, m, x, y) = RL()
cnt = 1
print(x, y)
for i in range(1, m + 1):
	if i != y:
		print(x, i)
xc = x - 1
flag = 0
total = 1
flag2 = 0
while total != n:
	if flag2 == 0:
		if flag == 0:
			for i in range(m, 0, -1):
				print(xc, i)
			flag = 1
		else:
			for i in range(1, m + 1):
				print(xc, i)
			flag = 0
		xc -= 1
		total += 1
	else:
		if flag == 0:
			for i in range(m, 0, -1):
				print(xc, i)
			flag = 1
		else:
			for i in range(1, m + 1):
				print(xc, i)
			flag = 0
		xc += 1
		total += 1
	if xc == 0:
		flag2 = 1
		xc = x + 1


(n, m, s_x, s_y) = [int(i) for i in input().split()]
print(s_x, s_y)
print(1, s_y)
print(1, 1)
for i in range(1, n + 1):
	for j in range(1, m + 1):
		if i % 2 == 1:
			a = i
			b = j
		else:
			a = i
			b = m + 1 - j
		if [a, b] != [s_x, s_y] and [a, b] != [1, s_y] and ([a, b] != [1, 1]):
			print(a, b)


(n, m, x, y) = map(int, input().split())
y1 = y - 1
while y != m + 1:
	print(x, y)
	y = y + 1
while y1 != 0:
	print(x, y1)
	y1 = y1 - 1
i = 1
z = 1
while i <= n:
	if i == x:
		i = i + 1
		continue
	if z % 2 != 0:
		for j in range(1, m + 1):
			print(i, j)
		i = i + 1
		z = z + 1
		continue
	if z % 2 == 0:
		for j in range(m, 0, -1):
			print(i, j)
		i = i + 1
		z = z + 1
		continue


from sys import stdin, stdout
nmxy = stdin.readline().split()
n = int(nmxy[0])
m = int(nmxy[1])
x1 = int(nmxy[2])
y1 = int(nmxy[3])
x = x1
y = y1
stdout.write(str(x) + ' ' + str(y) + '\n')
for z in range(m):
	if z != y1 - 1:
		stdout.write(str(x1) + ' ' + str(z + 1) + '\n')
y = m
for z in range(m):
	if z % 2 == 0:
		while x > 1:
			x -= 1
			stdout.write(str(x) + ' ' + str(y) + '\n')
	else:
		while x < x1 - 1:
			x += 1
			stdout.write(str(x) + ' ' + str(y) + '\n')
	if y > 1:
		y -= 1
		stdout.write(str(x) + ' ' + str(y) + '\n')
x = x1 + 1
stdout.write(str(x) + ' ' + str(y) + '\n')
for z in range(m):
	if z % 2 == 0:
		while x < n:
			x += 1
			stdout.write(str(x) + ' ' + str(y) + '\n')
	else:
		while x > x1 + 1:
			x -= 1
			stdout.write(str(x) + ' ' + str(y) + '\n')
	if y < m:
		y += 1
		stdout.write(str(x) + ' ' + str(y) + '\n')


def chess(a):
	n = a[0]
	m = a[1]
	x = a[2]
	y = a[3]
	c1 = 0
	i1 = 1
	while c1 != m:
		print(x, y)
		c1 += 1
		if c1 == m:
			break
		if y + i1 <= m:
			y += i1
		else:
			y = a[3] - 1
			i1 = -1
	if x + 1 <= n:
		x += 1
	else:
		x = 1
	c = m
	i = -i1
	while c != n * m:
		print(x, y)
		c += 1
		if y + i > m or y + i < 1:
			if x + 1 <= n:
				x += 1
				i = -i
			elif x + 1 > n:
				x = 1
				i = -i
		else:
			y += i
	return
array = list(map(int, input().split(' ')))
chess(array)


def f(t, row, m):
	col = [i for i in range(1, m + 1) if i != t[1]]
	res = [(row, t[1])]
	for ele in col:
		res.append((row, ele))
	return res
(n, m, a, b) = map(int, input().split())
ans = f((a, b), a, m)
for row in range(1, n + 1):
	if row == a:
		continue
	last = ans[-1]
	ans.extend(f(last, row, m))
for t in ans:
	print(t[0], t[1])


(n, m, ix, iy) = [int(i) for i in input().split()]
ans = [[ix, iy]]
for i in range(1, m + 1):
	if i != iy:
		ans.append([ix, i])
(x, y) = (ix, m)
while x < n:
	if y == m:
		x += 1
		for i in range(m, 0, -1):
			ans.append([x, i])
		y = 1
	elif y == 1:
		x += 1
		for i in range(1, m + 1):
			ans.append([x, i])
		y = m
x = ix
while x > 1:
	if y == m:
		x -= 1
		for i in range(m, 0, -1):
			ans.append([x, i])
		y = 1
	elif y == 1:
		x -= 1
		for i in range(1, m + 1):
			ans.append([x, i])
		y = m
for i in ans:
	print(i[0], i[1])


(n, m, sx, sy) = [int(x) for x in input().strip().split()]
print(sx, sy)
print(1, sy)
print(1, 1)
visited = {(1, 1), (1, sy), (sx, sy)}
down = True
for i in range(1, n + 1):
	if down:
		for j in range(1, m + 1):
			if not (i, j) in visited:
				print(i, j)
	else:
		for j in range(m, 0, -1):
			if not (i, j) in visited:
				print(i, j)
	down = not down


import os
import sys
from io import BytesIO, IOBase

def main():
	(n, m, x, y) = inmap()
	for i in range(y, 0, -1):
		print(x, i)
	for i in range(y + 1, m + 1):
		print(x, i)
	ltr = False
	for i in range(x + 1, n + 1):
		if ltr:
			for j in range(1, m + 1):
				print(i, j)
			ltr = False
		else:
			for j in range(m, 0, -1):
				print(i, j)
			ltr = True
	for i in range(x - 1, 0, -1):
		if ltr:
			for j in range(1, m + 1):
				print(i, j)
			ltr = False
		else:
			for j in range(m, 0, -1):
				print(i, j)
			ltr = True
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
inint = lambda : int(input())
inarr = lambda : list(map(int, input().split()))
inmap = lambda : map(int, input().split())
instr = lambda : input().split()
main()


(n, m, s, t) = map(int, input().split())
s -= 1
t -= 1
ss = s
v = [[False for i in range(m)] for j in range(n)]
v[s][t] = True
print(s + 1, t + 1)
(s, t) = (s, 0)
v[s][t] = True
print(s + 1, t + 1)
while t < m:
	if not v[ss][t]:
		(s, t) = (ss, t)
		print(s + 1, t + 1)
		v[s][t] = True
	for j in range(n):
		if j == ss:
			continue
		if not v[j][t]:
			(s, t) = (j, t)
			print(s + 1, t + 1)
			v[s][t] = True
	t += 1
	if t == m:
		break
	print(s + 1, t + 1)
	v[s][t] = True


(n, m, sx, sy) = map(int, input().split())
thingy = sy
thingx = sx
i = 0
print(sx, sy)
for j in range(n):
	for k in range(m):
		i += 1
		if not k:
			i += m - 1
		thingy = (sy + i) % m
		thingx = (sx + j) % n
		if j % 2 == 0:
			if not thingy:
				thingy = m
			if not thingx:
				thingx = n
			if thingx != sx or thingy != sy:
				print(thingx, thingy)
		else:
			if not thingy:
				thingy = m
			if not thingx:
				thingx = n
			if thingx != sx or thingy != sy:
				print(thingx, thingy)


(n, m, sx, sy) = input().split()
n = int(n)
m = int(m)
sx = int(sx)
sy = int(sy)
sx -= 1
sy -= 1

def visit(x, y):
	print(x + 1, y + 1)
x = sx
y = sy
for _ in range(n):
	for j in range(m):
		visit(x, y)
		y += 1
		y %= m
	y -= 1
	y %= m
	x += 1
	x %= n


(i, j, x, y) = input().split()
i = int(i)
j = int(j)
pos = [int(x), int(y)]

def visit_all(i, j, iniz):
	pos = iniz.copy()
	I = list(range(i))
	I.remove(pos[0] - 1)
	print(pos[0], pos[1])
	while pos[1] < j:
		pos[1] += 1
		print(pos[0], pos[1])
	pos[1] = iniz[1]
	while pos[1] > 1:
		pos[1] += -1
		print(pos[0], pos[1])
	for q in I:
		pre = pos[1]
		pos[0] = q + 1
		print(pos[0], pos[1])
		if pre == 1:
			while pos[1] < j:
				pos[1] += 1
				print(pos[0], pos[1])
		else:
			while pos[1] > 1:
				pos[1] += -1
				print(pos[0], pos[1])
visit_all(i, j, pos)


(n, m, sy, sx) = map(int, input().split())
ans = []
ans.append((sy, sx))
rest = []
for j in range(1, m + 1):
	if j != sx:
		rest.append((sy, j))
ans.extend(rest)
reverse = True
for i in range(n):
	if i + 1 != sy:
		row = [(i + 1, j) for j in range(1, m + 1)]
		if reverse:
			row.reverse()
		ans.extend(row)
		reverse = not reverse
for (i, j) in ans:
	print(i, j)


(n, m, x, y) = map(int, input().split())
b = 0
x0 = x
y0 = y
for i in range(m * n):
	print(x, y)
	if b == 0:
		y -= 1
		if y == 0:
			y = y0 + 1
			b = 1
	elif b == 1:
		y += 1
		if y == m + 1:
			x -= 1
			y = m
			b = 2
	elif b == 2:
		y -= 1
		if y == 0:
			y = 1
			x -= 1
			if x == 0:
				x = x0 + 1
				b = 5
			else:
				b = 3
	elif b == 3:
		y += 1
		if y == m + 1:
			y = m
			x -= 1
			if x == 0:
				x = x0 + 1
				b = 4
			else:
				b = 2
	elif b == 4:
		y -= 1
		if y == 0:
			y = 1
			x += 1
			b = 5
	else:
		y += 1
		if y == m + 1:
			y = m
			x += 1
			b = 4


from sys import stdin, stdout
(n, m, x, y) = list(map(int, stdin.readline().split()))
l = [[0 for i in range(m + 1)] for i in range(n + 1)]
while x > 1:
	if l[x][y] != 1:
		print(x, y)
		l[x][y] = 1
	x -= 1
while y > 0:
	if l[x][y] != 1:
		print(x, y)
		l[x][y] = 1
	y -= 1
flag = 1
for i in range(1, n + 1):
	if flag == 1:
		for j in range(1, m + 1):
			if l[i][j] != 1:
				l[i][j] = 1
				print(i, j)
		flag = 0
	else:
		for j in range(m, 0, -1):
			if l[i][j] != 1:
				l[i][j] = 1
				print(i, j)
		flag = 1


def go(x, y, n, m, ch, fl):
	for i in range(n):
		for j in range(m):
			if ch:
				print(x, y)
			else:
				print(y, x)
			if fl:
				y += 1
				if y == m + 1:
					y = 1
			else:
				y -= 1
				if y == 0:
					y = m
		if fl:
			y -= 1
		else:
			y += 1
		fl = not fl
		x += 1
		if x == n + 1:
			x = 1

def solve():
	(n, m, x, y) = map(int, input().split())
	fl = True
	if m % 2 == 0:
		go(y, x, m, n, False, fl)
	elif n % 2 == 0:
		go(x, y, n, m, True, fl)
	elif x < n:
		go(x, y, n - 1, m, True, fl)
		for i in range(m):
			print(n, (y - 1 + i) % m + 1)
	elif y < m:
		go(y, x, m - 1, n)
		for i in range(n):
			print((x - 1 + i) % n + 1, m)
	else:
		for i in range(n):
			for g in range(m):
				print(x, y)
				if fl:
					y += 1
					if y == m + 1:
						y = 1
					else:
						y -= 1
						if y == 0:
							y = m
			if fl:
				y -= 1
			else:
				y += 1
			fl = not fl
			x += 1
			if x == n + 1:
				x = 1
solve()


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

def solve(sx, sy, flag):
	(x, y) = (sx, sy)
	(prev1, prev2) = (-1, -1)
	while x >= 1:
		(prev1, prev2) = (x, y)
		ans.append((x, y))
		x -= 1
	sx += 1
	(x, y) = (sx, sy)
	while x != n + 1:
		(prev1, prev2) = (x, y)
		ans.append((x, y))
		x += 1
	if flag:
		return (prev1, prev2 + 1)
	else:
		return (prev1, prev2 - 1)
ans = []
(x, y) = (sx, sy)
while y > 0:
	(x, y) = solve(x, y, 0)
(x, y) = (x, sy + 1)
while y <= m:
	(x, y) = solve(x, y, 1)
for i in ans:
	print(*i)


import random as r
rr = lambda : input().strip()
rrm = lambda : map(int, rr().split())

def solve():
	(n, m, sx, sy) = rrm()
	ml = list(range(1, m + 1))
	while 1:
		print(sx, sy)
		temp = list(range(1, n + 1))
		while 1:
			temp.remove(sx)
			if temp == []:
				break
			sx = r.choice(temp)
			print(sx, sy)
		ml.remove(sy)
		if ml == []:
			break
		sy = r.choice(ml)
solve()


(n, m, x, y) = list(map(int, input().split()))
i = x
j = y
dont = []
dont.append([x, y])
print('{} {}'.format(x, y))
if not [1, y] in dont:
	print('{} {}'.format(1, y))
	dont.append([1, y])
if not [1, 1] in dont:
	print('{} {}'.format(1, 1))
	dont.append([1, 1])
flag = 0
for i in range(1, n + 1):
	if flag == 0:
		for j in range(1, m + 1):
			if not [i, j] in dont:
				print('{} {}'.format(i, j))
		flag = 1 - flag
	else:
		for j in range(m, 0, -1):
			if not [i, j] in dont:
				print('{} {}'.format(i, j))
		flag = 1 - flag


import sys, math, cmath, time
start_time = time.time()

def solve():
	(n, m, x, y) = invr()
	q = [[0] * m for i in range(n)]
	a = [str(x) + ' ' + str(y), '1 ' + str(y), '1 1']
	qw = [str(x) + ' ' + str(y), '1 ' + str(y), '1 1']
	for i in range(n):
		for j in range(m):
			if i % 2 == 0:
				w = str(i + 1) + ' ' + str(j + 1)
			else:
				w = str(i + 1) + ' ' + str(m - j)
			if w not in qw:
				a.append(w)
	print(*a, sep='\n')

def main():
	global tt
	if not ONLINE_JUDGE:
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	t = 1
	for tt in range(t):
		solve()
	if not ONLINE_JUDGE:
		print('Time Elapsed :', time.time() - start_time, 'seconds')
		sys.stdout.close()

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	return input().strip()

def invr():
	return map(int, input().split())

def counter(a):
	q = [0] * max(a)
	for i in range(len(a)):
		q[a[i] - 1] = q[a[i] - 1] + 1
	return q

def counter_elements(a):
	q = dict()
	for i in range(len(a)):
		if a[i] not in q:
			q[a[i]] = 0
		q[a[i]] = q[a[i]] + 1
	return q

def string_counter(a):
	q = [0] * 26
	for i in range(len(a)):
		q[ord(a[i]) - 97] = (q[ord(a[i]) - 97], 1)
	return q

def factors(n):
	q = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			q.append(i)
			q.append(n // i)
	return list(sorted(list(set(q))))

def prime_factors(n):
	q = []
	while n % 2 == 0:
		q.append(2)
		n = n // 2
	for i in range(3, int(n ** 0.5) + 1, 2):
		while n % i == 0:
			q.append(i)
			n = n // i
	if n > 2:
		q.append(n)
	return list(sorted(q))

def transpose(a):
	(n, m) = (len(a), len(a[0]))
	b = [[0] * n for i in range(m)]
	for i in range(m):
		for j in range(n):
			b[i][j] = a[j][i]
	return b

def factorial(n, m=1000000007):
	q = 1
	for i in range(n):
		q = q * (i + 1) % 1000000007
	return q
ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
	input = sys.stdin.readline
main()


import sys

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def rinput():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))
mod = int(1000000000.0) + 7
(n, m, sx, sy) = rinput()
visit = [[0 for _ in range(m)] for _ in range(n)]
ans = [[sx - 1, sy - 1]]
visit[sx - 1][sy - 1] = 1
if sx != 1:
	ans.append([0, sy - 1])
	visit[0][sy - 1] = 1
row = 0
col = sy - 1
for j in range(col - 1, -1, -1):
	if visit[row][j] == 0:
		ans.append([row, j])
		visit[row][j] = 1
for j in range(col + 1, m):
	if visit[row][j] == 0:
		ans.append([row, j])
		visit[row][j] = 1
row += 1
flag = True
while 1:
	if flag:
		for j in range(m - 1, -1, -1):
			if visit[row][j] == 0:
				ans.append([row, j])
				visit[row][j] = 1
		flag = False
	else:
		for j in range(m):
			if visit[row][j] == 0:
				ans.append([row, j])
				visit[row][j] = 1
		flag = True
	row += 1
	if row == n:
		break
for item in ans:
	print(item[0] + 1, item[1] + 1)


import sys
input = sys.stdin.readline

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

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

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def upper_bound(a, x, lo=0, hi=None):
	if hi == None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

def int_array():
	return list(map(int, input().strip().split()))

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
from datetime import datetime
init_time = datetime.now()
import math

def FOR(n, m, x, y, i):
	for j in range(1, m + 1):
		print((i + x - 2) % n + 1, (j + y - 2) % m + 1)

def ROF(n, m, x, y, i):
	for j in range(m, 0, -1):
		print((i + x - 2) % n + 1, (j + y - 2) % m + 1)

def solve():
	(n, m, x, y) = map(int, input().split())
	for i in range(1, n + 1):
		if i % 2 == 1:
			FOR(n, m, x, y, i)
		else:
			ROF(n, m, x, y, i)
for _ in range(1):
	solve()


def readGenerator():
	while True:
		tokens = input().split(' ')
		for t in tokens:
			yield t
reader = readGenerator()

def readWord():
	return next(reader)

def readInt():
	return int(next(reader))

def readFloat():
	return float(next(reader))

def readLine():
	return input()

def solve(n):
	return n
(n, m) = (readInt(), readInt())
(x, y) = (readInt() - 1, readInt() - 1)
cy = y
cx = x
res = []
yVis = [False] * m
yVis[cy] = True
for i in range(0, m):
	visited = [False] * n
	visited[cx] = True
	res.append((cx + 1, cy + 1))
	for j in range(0, n - 1):
		for k in range(0, n):
			if not visited[k]:
				cx = k
				res.append((cx + 1, cy + 1))
				visited[cx] = True
				break
	for k in range(0, m):
		if not yVis[k]:
			cy = k
			yVis[k] = True
			break
for (x, y) in res:
	print(x, y)


from __future__ import division, print_function
from sys import stdin, stdout
import bisect
import math
import heapq
i_m = 9223372036854775807

def inin():
	return int(input())

def stin():
	return input()

def spin():
	return map(int, stin().split())

def lin():
	return list(map(int, stin().split()))

def matrix(n):
	return [list(map(int, input().split())) for i in range(n)]

def count2Dmatrix(i, list):
	return sum((c.count(i) for c in list))

def modinv(n, p):
	return pow(n, p - 2, p)

def GCD(x, y):
	x = abs(x)
	y = abs(y)
	if min(x, y) == 0:
		return max(x, y)
	while y:
		(x, y) = (y, x % y)
	return x

def Divisors(n):
	l = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l
prime = []

def SieveOfEratosthenes(n):
	global prime
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	f = []
	for p in range(2, n):
		if prime[p]:
			f.append(p)
	return f
q = []

def dfs(n, d, v, c):
	global q
	v[n] = 1
	x = d[n]
	q.append(n)
	j = c
	for i in x:
		if i not in v:
			f = dfs(i, d, v, c + 1)
			j = max(j, f)
	return j
(n, m, x, y) = spin()
(c, r, tc, tr) = (1, 0, 0, 0)
(col, row) = ([], [])
print(x, y)
for i in range(m):
	if i + 1 != y:
		print(x, i + 1)
tr = x
tc = y
for i in range(n):
	if i + 1 != x:
		row.append(i + 1)
tr = row[0]
c = 0
for i in row:
	if c % 2 == 0:
		for j in range(m, 0, -1):
			print(i, j)
	else:
		for j in range(m):
			print(i, j + 1)
	c += 1


[n, m, x, y] = [int(p) for p in input().split()]
print('{x1} {y1}'.format(x1=x, y1=y))
print('{x1} {y1}'.format(x1=1, y1=y))
for i in range(1, n + 1):
	if i % 2 == 1:
		for j in range(1, m + 1):
			if i == 1 and j == y:
				continue
			elif i == x and j == y:
				continue
			else:
				print('{x1} {y1}'.format(x1=i, y1=j))
	else:
		for j in range(m, 0, -1):
			if i == x and j == y:
				continue
			else:
				print('{x1} {y1}'.format(x1=i, y1=j))


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

def f(i, j):
	return ((i + sx - 2) % n + 1, (j + sy - 2) % m + 1)
for i in range(1, n + 1):
	if i % 2:
		for k in range(1, m + 1):
			(a, b) = f(i, k)
			print(a, b)
	else:
		for k in range(m, 0, -1):
			(a, b) = f(i, k)
			print(a, b)


def main():

	def visit(row, column):
		visited[row][column] = 1
		print(row + 1, column + 1)
		position[0] = row
		position[1] = column
	(n, m, startRow, startColumn) = map(lambda x: int(x), input().split())
	startRow -= 1
	startColumn -= 1
	visited = [[0] * m for i in range(n)]
	position = [startRow, startColumn]
	visit(startRow, startColumn)
	visit(startRow, 0)
	visit(0, 0)
	deltaRow = 1
	for i in range(n * m - 3):
		while visited[position[0]][position[1]]:
			if deltaRow > 0:
				if position[0] < n - 1:
					position[0] += deltaRow
				else:
					position[1] += 1
					deltaRow = -1
			elif position[0] > 0:
				position[0] += deltaRow
			else:
				position[1] += 1
				deltaRow = 1
		visit(*position)
main()


import bisect
import decimal
from decimal import Decimal
import os
from collections import Counter
import bisect
from collections import defaultdict
import math
import random
import heapq
from math import sqrt
import sys
from functools import reduce, cmp_to_key
from collections import deque
import threading
from itertools import combinations
from io import BytesIO, IOBase
from itertools import accumulate
decimal.getcontext().prec = 46

def primeFactors(n):
	prime = set()
	while n % 2 == 0:
		prime.add(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			prime.add(i)
			n = n // i
	if n > 2:
		prime.add(n)
	return list(prime)

def getFactors(n):
	factors = []
	i = 1
	while i <= math.sqrt(n):
		if n % i == 0:
			if n // i == i:
				factors.append(i)
			else:
				factors.append(i)
				factors.append(n // i)
		i = i + 1
	return factors

def modefiedSieve():
	mx = 10 ** 7 + 1
	sieve = [-1] * mx
	for i in range(2, mx):
		if sieve[i] == -1:
			sieve[i] = i
			for j in range(i * i, mx, i):
				if sieve[j] == -1:
					sieve[j] = i
	return sieve

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	num = []
	for p in range(2, n + 1):
		if prime[p]:
			num.append(p)
	return num

def lcm(a, b):
	return a * b // math.gcd(a, b)

def sort_dict(key_value):
	return sorted(key_value.items(), key=lambda kv: (kv[1], kv[0]))

def list_input():
	return list(map(int, input().split()))

def num_input():
	return map(int, input().split())

def string_list():
	return list(input())

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def binaryToDecimal(n):
	return int(n, 2)

def DFS(n, s, adj):
	visited = [False for i in range(n + 1)]
	stack = []
	stack.append(s)
	while len(stack):
		s = stack[-1]
		stack.pop()
		if not visited[s]:
			visited[s] = True
		for node in adj[s]:
			if not visited[node]:
				stack.append(node)

def maxSubArraySum(a, size):
	maxint = 10 ** 10
	max_so_far = -maxint - 1
	max_ending_here = 0
	for i in range(0, size):
		max_ending_here = max_ending_here + a[i]
		if max_so_far < max_ending_here:
			max_so_far = max_ending_here
		if max_ending_here < 0:
			max_ending_here = 0
	return max_so_far

def solve():
	(n, m, x, y) = num_input()
	Y = y
	c = n * m
	up = x - 1
	while x <= n:
		c -= 1
		print(x, y)
		x += 1
	x = up
	while x > 0:
		c -= 1
		print(x, y)
		x -= 1
	(x, y) = (1, y - 1)
	down = True
	while y > 0:
		print(x, y)
		c -= 1
		if down:
			x += 1
			if x > n:
				x = n
				y -= 1
				down = False
		else:
			x -= 1
			if x == 0:
				x = 1
				y -= 1
				down = True
	y = Y + 1
	while c > 0:
		print(x, y)
		c -= 1
		if down:
			x += 1
			if x > n:
				x = n
				y += 1
				down = False
		else:
			x -= 1
			if x == 0:
				x = 1
				y += 1
				down = True
t = 1
for _ in range(t):
	solve()


(n, m, x, y) = map(int, input().split())
print(x, y)
print(1, y)
print(1, 1)
l = [(x, y), (1, y), (1, 1)]
for i in range(1, n + 1, 2):
	for j in range(1, m + 1):
		if (i, j) not in l:
			print(i, j)
	if i + 1 <= n:
		for j in range(m, 0, -1):
			if (i + 1, j) not in l:
				print(i + 1, j)


import math as mt

def tran(n, m, sx, sy):
	p = 0
	an = []
	for i in range(sx, n + 1):
		an.append([i, sy])
	for i in range(sx - 1, 0, -1):
		an.append([i, sy])
	sx = i
	while p == 0:
		if sx == n:
			sy += 1
			if sy <= m:
				for i in range(sx, 0, -1):
					an.append([i, sy])
				sx = i
			else:
				sy = 1
				for i in range(sx, 0, -1):
					an.append([i, sy])
				sx = i
		else:
			sy += 1
			if sy <= m:
				for i in range(1, n + 1):
					an.append([i, sy])
				sx = i
			else:
				sy = 1
				for i in range(1, n + 1):
					an.append([i, sy])
				sx = i
		if len(an) >= n * m:
			break
	return an
nk = list(map(int, input().rstrip().split()))
r = tran(nk[0], nk[1], nk[2], nk[3])
for i in r:
	print(*i)


(n, m, sx, sy) = map(int, input().split())
from collections import *
al = defaultdict(tuple)
ans = [[sx, sy], [1, sy], [1, 1]]
for i in range(1, n + 1):
	for j in range(1, m + 1):
		if i % 2 == 0:
			if [i, m - j + 1] != [1, 1] and [i, m - j + 1] != [sx, sy] and ([i, m - j + 1] != [1, sy]):
				ans.append([i, m - j + 1])
		elif [i, j] != [1, 1] and [i, j] != [sx, sy] and ([i, j] != [1, sy]):
			ans.append([i, j])
for i in range(len(ans)):
	print(ans[i][0], ans[i][1])


(n, m, x, y) = map(int, input().strip().split())
t = m
print(x, y)
while True:
	if t > 0 and t != y:
		print(x, t)
	if t == 0:
		break
	t -= 1
t = 1
flag = 0
for z in range(1, n + 1):
	if z != x:
		while True:
			if flag == 0:
				if t <= m:
					print(z, t)
					t += 1
				else:
					t = m
					flag = 1
					break
			if flag == 1:
				if t > 0:
					print(z, t)
					t -= 1
				else:
					t = 1
					flag = 0
					break


(n, m, x, y) = map(int, input().split())
l = []
print(x, y)
print(1, y)
print(1, 1)
l.append([x, y])
l.append([1, y])
l.append([1, 1])
x = y = 1
for z in range(n):
	if y == m and x <= n:
		x = x + 1
		for i in range(m):
			if [x, y] not in l:
				print(x, y)
			y = y - 1
		y += 1
		x += 1
	elif y == 1 and x <= n:
		for i in range(m):
			if [x, y] not in l:
				print(x, y)
			y += 1
		y -= 1


a = input().split()
(n, m, x, y) = (int(a[0]), int(a[1]), int(a[2]), int(a[3]))
a = []
a.append([x, y])
print(x, y)
while x != 1:
	x -= 1
	print(x, y)
	a.append([x, y])
while y != 1:
	y -= 1
	print(x, y)
	a.append([x, y])
for i in range(1, n + 1):
	if i % 2 == 1:
		for j in range(1, m + 1):
			if [i, j] not in a:
				print(i, j)
	else:
		for j in range(m, 0, -1):
			if [i, j] not in a:
				print(i, j)


def find_path(pos_x, pos_y, size_x, size_y):
	perfect_chain = _find_perfect_chain(size_x, size_y)
	start_index = perfect_chain.index((pos_x, pos_y))
	path = perfect_chain[start_index:] + perfect_chain[:start_index]
	return path

def _find_perfect_chain(size_x, size_y):
	if size_y % 2 == 0:
		result = []
		for y in range(size_y):
			if y % 2 == 0:
				chain_piece_xs = range(size_x)
			else:
				chain_piece_xs = reversed(range(size_x))
			result.extend(((x, y) for x in chain_piece_xs))
	elif size_x % 2 == 0:
		result = _find_perfect_chain(size_y=size_x, size_x=size_y)
		result = map(lambda pos: (pos[1], pos[0]), result)
	elif size_y == 1:
		result = ((x, 0) for x in range(size_x))
	else:
		result = list(_find_perfect_chain(size_x, size_y - 3))
		(latest_x, latest_y) = result[-1] if len(result) != 0 else (0, -1)
		for x in range(size_x):
			result.append((x, latest_y + 1))
		del latest_x, latest_y
		for (i_x, x) in enumerate(reversed(range(size_x))):
			ys = (size_y - 2, size_y - 1) if i_x % 2 == 0 else (size_y - 1, size_y - 2)
			for y in ys:
				result.append((x, y))
	return tuple(result)

def main():
	(size_x, size_y, pos_x, pos_y) = map(int, input().split())
	pos_x -= 1
	pos_y -= 1
	path = find_path(pos_x, pos_y, size_x, size_y)
	for cell in path:
		(x, y) = cell
		print(x + 1, y + 1)
main()


(n, m, sx, sy) = [int(s) for s in input().split(' ')]
p = []
flip = False
for i in range(sx, n + 1):
	if not flip:
		p.append((i, sy))
		for j in range(1, m + 1):
			if j != sy:
				p.append((i, j))
	else:
		for j in range(m, 0, -1):
			if j != sy:
				p.append((i, j))
		p.append((i, sy))
	flip = not flip
for i in range(1, sx):
	if not flip:
		p.append((i, sy))
		for j in range(1, m + 1):
			if j != sy:
				p.append((i, j))
	else:
		for j in range(m, 0, -1):
			if j != sy:
				p.append((i, j))
		p.append((i, sy))
	flip = not flip
for square in p:
	print(*square)


from functools import reduce
import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def arr():
	return [int(i) for i in input().split()]

def sarr():
	return [int(i) for i in input()]

def inn():
	return int(input())
mo = 1000000007
(n, m, x, y) = value()
print(x, y)
if x == 1:
	print(1, 1)
	for i in range(2, m + 1):
		if i != y:
			print(1, i)
	flag = 0
	for i in range(2, n + 1):
		if flag == 0:
			for j in range(m, 0, -1):
				print(i, j)
			flag = 1
		else:
			for j in range(1, m + 1):
				print(i, j)
			flag = 0
else:
	print(x, m)
	for i in range(m - 1, 0, -1):
		if i != y:
			print(x, i)
	flag = 0
	for i in range(1, x):
		if flag == 0:
			for j in range(1, m + 1):
				print(i, j)
			flag = 1
		else:
			for j in range(m, 0, -1):
				print(i, j)
			flag = 0
	for i in range(x + 1, n + 1):
		if flag == 0:
			for j in range(1, m + 1):
				print(i, j)
			flag = 1
		else:
			for j in range(m, 0, -1):
				print(i, j)
			flag = 0


from copy import deepcopy
(n, m, sx, sy) = map(int, input().split())
print(sx, sy)
(x, y) = (deepcopy(sx), deepcopy(sy))
l = [(x, y)]
for i in range(x + 1, n + 1):
	print(i, y)
	l.append((i, y))
for i in range(x - 1, 0, -1):
	print(i, y)
	l.append((i, y))
print(1, 1)
(x, y) = (1, 1)
l.append((1, 1))
while y <= m:
	(nx, ny) = (deepcopy(x), deepcopy(y))
	for i in range(x, n + 1):
		if not (i, y) in l:
			print(i, y)
			l.append((i, y))
			x = i
	for i in range(1, nx + 1):
		if not (i, y) in l:
			print(i, y)
			l.append((i, y))
			x = i
	if y + 1 == sy:
		y += 2
	else:
		y += 1


(n, m, x, y) = map(int, input().split())
print(x, y)
for i in range(y + 1, m + 1):
	print(x, i)
for i in range(y - 1, 0, -1):
	print(x, i)
pre = 1
temp = [i for i in range(1, n + 1) if i != x]
while temp:
	val = temp.pop()
	if pre == 1:
		for i in range(1, m + 1):
			print(val, i)
		pre = m
	else:
		for i in range(m, 0, -1):
			print(val, i)
		pre = 1


import sys
input = sys.stdin.readline

def main():
	(N, M, SX, SY) = [int(x) for x in input().split()]
	print(SX, SY)
	visited = set()
	visited.add((SX, SY))
	cx = SX
	cy = SY
	for i in range(1, N + 1):
		if (i, cy) not in visited:
			visited.add((i, cy))
			print(i, cy)
			cx = i
	for j in range(1, M + 1):
		if (cx, j) in visited:
			continue
		visited.add((cx, j))
		print(cx, j)
		cy = j
		for i in range(1, N + 1):
			if (i, cy) not in visited:
				visited.add((i, cy))
				print(i, cy)
				cx = i
main()


(n, m, r, c) = list(map(int, input().split(' ')))
(s_x, s_y) = (r, c)
cnt = 0
print(r, c)
cnt += 1
(r, c) = (1, c)
print(r, c)
cnt += 1
(r, c) = (1, 1)
print(r, c)
cnt += 1
while cnt <= n * m:
	while c + 1 <= m:
		c += 1
		if r == 1:
			if c != 1 and c != s_y:
				print(r, c)
				cnt += 1
		elif r == s_x:
			if c != s_y:
				print(r, c)
				cnt += 1
		else:
			print(r, c)
			cnt += 1
	if r + 1 <= n:
		r += 1
	else:
		break
	c += 1
	while c - 1 >= 1:
		c -= 1
		if r == 1:
			if c != 1 and c != s_y:
				print(r, c)
				cnt += 1
		elif r == s_x:
			if c != s_y:
				print(r, c)
				cnt += 1
		else:
			print(r, c)
			cnt += 1
	if r + 1 <= n:
		r += 1
	else:
		break
	c -= 1


(n, m, x, y) = map(int, input().split())
print(x, y)
cnt = 0
for i in range(1, m + 1):
	if i != y:
		print(x, i)
down = True
for col in range(m, 0, -1):
	for y in range(1, n + 1):
		if down:
			if y != x:
				print(y, col)
		elif n + 1 - y != x:
			print(n + 1 - y, col)
	down = not down


(n, m, a, b) = map(int, input().split())
qq = []
c = b + 1
while b > 0:
	qq.append([a, b])
	b -= 1
while c <= m:
	qq.append([a, c])
	c += 1
w = 0
for i in range(a + 1, n + 1):
	w += 1
	if w % 2 != 0:
		z = m
		while z >= 1:
			qq.append([i, z])
			z -= 1
	else:
		z = 1
		while z <= m:
			qq.append([i, z])
			z += 1
if qq[-1][1] == m:
	e = -1
	x = a - 1
	while x >= 1:
		e += 1
		if e % 2 == 0:
			d = m
			while d >= 1:
				qq.append([x, d])
				d -= 1
		else:
			d = 1
			while d <= m:
				qq.append([x, d])
				d += 1
		x -= 1
else:
	e = -1
	x = a - 1
	while x >= 1:
		e += 1
		if e % 2 != 0:
			d = m
			while d >= 1:
				qq.append([x, d])
				d -= 1
		else:
			d = 1
			while d <= m:
				qq.append([x, d])
				d += 1
		x -= 1
for h in qq:
	for r in h:
		print(r, end=' ')
	print()


(n, m, sx, sy) = map(int, input().split())
vis = [sx, sy]
print(sx, sy)
lst = 0
for i in range(1, m + 1):
	if i == sy:
		continue
	print(*[sx, i])
	lst = i
vis = [1, lst]
if sx == 1:
	vis = [2, lst]
print(*vis)
for i in range(1, n + 1):
	if i == sx:
		continue
	for j in range(1, m + 1):
		if j == vis[1]:
			continue
		print(*[i, j])
		lst = j
	vis = [i + 1, lst]
	if sx == i + 1:
		vis[0] += 1
	if vis[0] > n or vis[1] > m:
		break
	print(*vis)


(n, m, sx, sy) = list(map(int, input().split()))
print(sx, sy)
print(sx, 1)
for j in range(m):
	for i in range(n):
		if j % 2 == 1:
			k = n - i - 1
		else:
			k = i
		if k + 1 == sx and j + 1 == sy or (k + 1 == sx and j + 1 == 1):
			continue
		else:
			print(k + 1, j + 1)


import os
import sys
from io import BytesIO, IOBase
profile = 0
pypy = 1

def iin():
	return int(input())

def lin():
	return list(map(int, input().split()))

def main():
	T = 1
	while T:
		T -= 1
		(n, m, sx, sy) = lin()
		ans = [(sx, sy)]
		ch = 1
		for i in range(sx, n + 1):
			ch += 1
			rg = range(1, m + 1)
			if ch % 2:
				rg = range(m, 0, -1)
			for j in rg:
				if j == sy:
					continue
				ans.append((i, j))
			sy = -1
		for i in range(1, sx):
			ch += 1
			rg = range(1, m + 1)
			if ch % 2:
				rg = range(m, 0, -1)
			for j in rg:
				if j == sy:
					continue
				ans.append((i, j))
			sy = -1
		for (i, j) in ans:
			print(i, j)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
if pypy:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
	input = lambda : sys.stdin.readline().rstrip('\r\n')
if profile:
	import cProfile
	cProfile.run('main()')
else:
	main()


import sys

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s)
	sys.stdout.write('\n')

def wi(n):
	sys.stdout.write(str(n))
	sys.stdout.write('\n')

def wia(a, sep=' '):
	sys.stdout.write(sep.join([str(x) for x in a]))
	sys.stdout.write('\n')
from collections import deque

def main():
	(n, m, x, y) = ria()
	x -= 1
	y -= 1
	res = []
	v = [[False] * m for _ in range(n)]
	res.append((x, y))
	v[x][y] = True

	def fill_row(r, c):
		if not v[r][c]:
			res.append((r, c))
			v[r][c] = True
		to_visit = set([j for j in range(1, m - 1) if not v[r][j]])
		if len(to_visit) == 0:
			if not v[r + 1][c]:
				return (r + 1, c)
			else:
				return (r + 2, c)
		out_col = None
		for out_col in to_visit:
			if not v[r + 1][out_col]:
				break
		to_visit.remove(out_col)
		for c in to_visit:
			res.append((r, c))
			v[r][c] = True
		if not v[r][out_col]:
			res.append((r, out_col))
			v[r][out_col] = True
		return (r + 1, out_col)
	r = 1
	c = y
	while r < n - 1:
		(r, c) = fill_row(r, c)
	res.append((n - 1, c))
	v[n - 1][c] = True
	q = deque([(n - 1, c - 1)])
	while q:
		(r, c) = q.popleft()
		res.append((r, c))
		v[r][c] = True
		if r > 0 and (not v[r - 1][c]):
			q.append((r - 1, c))
		if r < n - 1 and (not v[r + 1][c]):
			q.append((r + 1, c))
		if c > 0 and (not v[r][c - 1]):
			q.append((r, c - 1))
		if c < m - 1 and (not v[r][c + 1]):
			q.append((r, c + 1))
	for r in res:
		wia([r[0] + 1, r[1] + 1])
main()


import sys
from collections import defaultdict as dd
from collections import deque
from functools import *
from fractions import Fraction as f
from copy import *
from bisect import *
from heapq import *
from math import *
from itertools import permutations

def eprint(*args):
	print(*args, file=sys.stderr)
zz = 1
if zz:
	input = sys.stdin.readline
else:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('all.txt', 'w')

def inc(d, c):
	d[c] = d[c] + 1 if c in d else 1

def li():
	return [int(xx) for xx in input().split()]

def fli():
	return [float(x) for x in input().split()]

def comp(a, b):
	if a > b:
		return 2
	return 2 if a == b else 0

def gi():
	return [xx for xx in input().split()]

def fi():
	return int(input())

def pro(a):
	return reduce(lambda a, b: a * b, a)

def swap(a, i, j):
	(a[i], a[j]) = (a[j], a[i])

def si():
	return list(input().rstrip())

def mi():
	return map(int, input().split())

def gh():
	sys.stdout.flush()

def isvalid(i, j):
	return 0 <= i < n and 0 <= j < n

def graph(n, m):
	for i in range(m):
		(x, y) = mi()
		a[x].append(y)
		a[y].append(x)
t = 1
while t > 0:
	t -= 1
	(n, m, x, y) = mi()
	d = []
	vis = [[0 for i in range(m + 1)] for j in range(n + 1)]
	c = 0
	l = 1
	r = 0
	for i in range(n):
		d.append([x, y])
		vis[x][y] = l
		l += 1
		if c % 2 == 0:
			for j in range(m - 1, -1, -1):
				if vis[x][j + 1] == 0 and j >= 0:
					d.append([x, j + 1])
					vis[x][j + 1] = l
					l += 1
		else:
			for j in range(0, m):
				if vis[x][j + 1] == 0 and j >= 0:
					d.append([x, j + 1])
					vis[x][j + 1] = l
					l += 1
		if x == 1:
			r = 1
			for j in range(1, n + 1):
				if vis[j][1] == 0:
					x = j
					break
		elif r == 0:
			x -= 1
		else:
			x += 1
		y = 1 if c % 2 == 0 else m
		c += 1
	for i in d:
		print(*i)


from sys import stdin, stdout
input = stdin.readline
print = stdout.write
(n, m, sx, sy) = map(int, input().split())
ans = []
for y in range(sy, m + 1):
	ans.append('{0} {1}'.format(sx, y))
for y in range(sy - 1, 0, -1):
	ans.append('{0} {1}'.format(sx, y))
d = 0
for x in range(sx + 1, n + 1):
	d = (d + 1) % 2
	if d:
		for y in range(1, m + 1):
			ans.append('{0} {1}'.format(x, y))
	else:
		for y in range(m, 0, -1):
			ans.append('{0} {1}'.format(x, y))
for x in range(sx - 1, 0, -1):
	d = (d + 1) % 2
	if d:
		for y in range(1, m + 1):
			ans.append('{0} {1}'.format(x, y))
	else:
		for y in range(m, 0, -1):
			ans.append('{0} {1}'.format(x, y))
ans = '\n'.join(ans)
print(ans)


(n, m, x, y) = [int(k) for k in input().split()]
print(x, y)
for j in range(m):
	if j + 1 != y:
		print(x, j + 1)
		r = j + 1
	else:
		r = y
z = r
for j in range(1, n + 1):
	if j != x:
		print(j, r)
		for k in range(1, m + 1):
			if k != r:
				print(j, k)
				z = k
	r = z


(n, m, x, y) = map(int, input().split())
(a, b) = (1, 2)
print(x, y)
print(1, y)
print(1, 1)
while a <= n:
	while b <= m:
		if (a, b) != (1, y) and (a, b) != (x, y):
			print(a, b)
		b += 1
	a += 1
	b -= 1
	if a <= n:
		while b >= 1:
			if (a, b) != (1, y) and (a, b) != (x, y):
				print(a, b)
			b -= 1
		b += 1
		a += 1


import sys
from math import sqrt
from collections import OrderedDict
inpt = sys.stdin.readline

def inp():
	return int(inpt())

def inlist():
	return list(map(int, inpt().split()))

def instr():
	s = inpt()
	return list(s[:len(s) - 1])

def invr():
	return map(int, inpt().split())

class node(object):

	def __init__(self, x, p, h):
		(self.x, self.p, self.h) = (x, p, h)
		self.children = []

	def add_child(self, obj):
		self.children.append(obj)

def main():
	(n, m, x, y) = invr()
	for i in range(0, n):
		for j in range(0, m):
			a = i + x if i + x <= n else i + x - n
			b = j + y if j + y <= m else j + y - m
			print(a, b)
		y = y - 1 if y - 1 > 0 else m
main()


import os
import re
import sys
from bisect import bisect, bisect_left, insort, insort_left
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from io import BytesIO, IOBase
from itertools import accumulate, combinations, combinations_with_replacement, groupby, permutations, product
from math import acos, asin, atan, ceil, cos, degrees, factorial, hypot, log2, pi, radians, sin, sqrt, tan
from operator import itemgetter, mul
from string import ascii_lowercase, ascii_uppercase, digits

def inp():
	return int(input())

def inlist():
	return list(map(int, input().split()))

def instr():
	s = input()
	return list(s[:len(s)])

def invr():
	return map(int, input().split())

def visitRow(r, c, n, m):
	y = c
	print(r, c)
	for i in range(1, m + 1):
		if i == c:
			continue
		y = i
		print(r, i)
	return (r, y)

def main():
	(n, m, x, y) = invr()
	for i in range(x, n + 1):
		(tx, y) = visitRow(i, y, n, m)
	for i in range(1, x):
		(tx, y) = visitRow(i, y, n, m)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')
main()


(n, m, x, y) = list(map(int, input().split()))
x -= 1
y -= 1
(x, y) = (y, x)
fx = x
fy = y

def printd(xi, yi):
	print(yi, xi)
printd(x + 1, y + 1)
for i in range(x):
	printd(i + 1, y + 1)
for i in range(x + 1, m):
	printd(i + 1, y + 1)
fl = True
for i in range(y):
	for g in range(m):
		if fl:
			printd(m - g, i + 1)
		else:
			printd(g + 1, i + 1)
	fl = not fl
for i in range(y + 1, n):
	for g in range(m):
		if fl:
			printd(m - g, i + 1)
		else:
			printd(g + 1, i + 1)
	fl = not fl


(n, m, sx, sy) = map(int, input().split())
arr = [[sx, sy], [1, sy], [1, 1]]
k = True
for i in range(1, n + 1):
	for j in range(1, m + 1):
		if k:
			if [i, j] != [sx, sy] and [i, j] != [1, sy] and ([i, j] != [1, 1]):
				arr.append([i, j])
		elif [i, m + 1 - j] != [sx, sy] and [i, j] != [1, sy] and ([i, j] != [1, 1]):
			arr.append([i, m + 1 - j])
	if k == True:
		k = False
	else:
		k = True
for i in arr:
	s = map(str, i)
	si = ' '.join(s)
	print(si)


import os
import sys
from io import BytesIO, IOBase

def solution(n, m, sx, sy):
	sx -= 1
	sy -= 1
	grid = [[(i, j) for j in range(m)] for i in range(n)]
	res = [(sx, sy)]
	res.extend(grid[sx][sy + 1:])
	res.extend(grid[sx][:sy][::-1])
	switch = True
	for row in grid[sx + 1:]:
		if switch:
			res.extend(row)
		else:
			res.extend(row[::-1])
		switch = not switch
	for row in grid[:sx]:
		if switch:
			res.extend(row)
		else:
			res.extend(row[::-1])
		switch = not switch
	for (x, y) in res:
		write(x + 1, y + 1)

def main():
	(n, m, sx, sy) = r_array()
	solution(n, m, sx, sy)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def write(*args, end='\n'):
	for x in args[:-1]:
		sys.stdout.write(str(x) + ' ')
	sys.stdout.write(str(args[-1]))
	sys.stdout.write(end)

def r_array():
	return [int(x) for x in input().split()]

def r_int():
	return int(input())
main()


(n, m, x, y) = map(int, input().split())
l = []
a = x - 1
while x <= n:
	l.append([x, y])
	x += 1
while a >= 1:
	l.append([a, y])
	a -= 1
c = 0
for j in range(1, m + 1):
	if j == y:
		pass
	elif c % 2:
		for i in range(n, 0, -1):
			l.append([i, j])
		c += 1
	else:
		c += 1
		for i in range(1, n + 1):
			l.append([i, j])
for i in l:
	print(*i)


def main():
	(n, m, sx, sy) = map(int, input().split())
	ans = []
	(row, col) = (sx, sy)
	visited = set()
	while col >= 1:
		ans.append(str(row) + ' ' + str(col))
		visited.add((row, col))
		row += 1
		if row == n + 1:
			row = 1
		if (row, col) in visited:
			row -= 1
			if row == 0:
				row = n
			col -= 1
	col = sy + 1
	while col <= m:
		ans.append(str(row) + ' ' + str(col))
		visited.add((row, col))
		row += 1
		if row == n + 1:
			row = 1
		if (row, col) in visited:
			row -= 1
			if row == 0:
				row = n
			col += 1
	print('\n'.join(ans))
main()


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())

def comb(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)

def toord(c):
	return ord(c) - ord('a')

def lcm(a, b):
	return a * b // lcm(a, b)
mod = 998244353
INF = float('inf')
from math import factorial, sqrt, ceil, floor, gcd
from collections import Counter, defaultdict, deque
from heapq import heapify, heappop, heappush

def main():
	(n, m, x, y) = RL()
	rec = [[0] * (m + 1) for _ in range(n + 1)]

	def print_all(n, m):
		res = []
		tag = 0
		for i in range(1, n + 1):
			now = []
			for j in range(1, m + 1):
				now.append((i, j))
			if tag == 0:
				res.append(now)
			else:
				res.append(now[::-1])
			tag ^= 1
		for i in res:
			for (a, b) in i:
				if rec[a][b] == 1:
					continue
				print(a, b)
	print(x, y)
	rec[x][y] = 1
	while x > 1:
		print(x - 1, y)
		rec[x - 1][y] = 1
		x -= 1
	while y > 1:
		print(x, y - 1)
		rec[x][y - 1] = 1
		y -= 1
	print_all(n, m)
main()


(n, m, x, y) = map(int, input().split())
print(x, y)
print(1, y)
for i in range(1, m + 1):
	if i != y:
		print(1, i)
for i in range(2, n + 1):
	if i % 2 == 0:
		yy = m
		while yy > 0:
			if not (i == x and yy == y):
				print(i, yy)
			yy -= 1
	else:
		yy = 1
		while yy <= m:
			if not (i == x and yy == y):
				print(i, yy)
			yy += 1


import sys
input = sys.stdin.readline
(n, m, a, b) = map(int, input().split())
start = a - 1
for i in range(b, 0, -1):
	print(a, i)
for i in range(b + 1, m + 1):
	print(a, i)
a += 1
i = 0
ok = False
while ok == False:
	if i % 2 == 0:
		for j in range(m, 0, -1):
			print(a, j)
		a += 1
		i += 1
	else:
		for j in range(1, m + 1):
			print(a, j)
		a += 1
		i += 1
	if a == n + 1:
		ok = True
a = start
if j == m:
	i = 0
elif j == 1:
	i = 1
ok = False
while ok == False:
	if i % 2 == 0:
		for j in range(m, 0, -1):
			print(a, j)
		a -= 1
		i += 1
	else:
		for j in range(1, m + 1):
			print(a, j)
		a -= 1
		i += 1
	if a == 0:
		ok = True


(n, m, Sx, Sy) = [int(x) for x in input().split()]

def right(Py):
	return (Py + 1) % m

def left(Py):
	return (Py - 1) % m

def top(Px):
	return (Px - 1) % n

def bottom(Px):
	return (Px + 1) % n

def main():
	count = 1
	visited = [[0 for y in range(m)] for x in range(n)]
	visited[Sx - 1][Sy - 1] = 1
	(Px, Py) = (Sx - 1, Sy - 1)
	print(Px + 1, Py + 1)
	while count <= n * m:
		Py_r = right(Py)
		Py_l = left(Py)
		Px_t = top(Px)
		Px_b = bottom(Px)
		if visited[Px][Py_r] == 0:
			visited[Px][Py_r] = 1
			Py = Py_r
			print(Px + 1, Py + 1)
		elif visited[Px][Py_l] == 0:
			visited[Px][Py_l] = 1
			Py = Py_l
			print(Px + 1, Py + 1)
		elif visited[Px_t][Py] == 0:
			visited[Px_t][Py] = 1
			Px = Px_t
			print(Px + 1, Py + 1)
		elif visited[Px_b][Py] == 0:
			visited[Px_b][Py] = 1
			Px = Px_b
			print(Px + 1, Py + 1)
		count += 1
main()


s = input()
(n, m, x, y) = [int(i) for i in s.split(' ')]
print(x, y)
(tx, ty) = (1, y)
if (tx, ty) != (x, y):
	print(tx, ty)
for cs in range(1, n + 1, 2):
	for ys in range(1, m + 1):
		if (cs, ys) != (tx, ty) and (cs, ys) != (x, y):
			print(cs, ys)
	cs += 1
	if cs > n:
		continue
	for ys in range(m, 0, -1):
		if (cs, ys) != (tx, ty) and (cs, ys) != (x, y):
			print(cs, ys)


(n, m, x, y) = list(map(int, input().split()))
print(x, y)
for i in range(1, m + 1):
	if i != y:
		print(x, i)
traversed = 0
for row in range(1, n + 1):
	if row != x:
		if row + traversed & 1:
			for i in range(m, 0, -1):
				print(row, i)
		else:
			for i in range(1, m + 1):
				print(row, i)
	else:
		traversed = 1


(n, m, x, y) = tuple(map(int, input().split()))
print(x, y)
for i in range(y + 1, m + 1):
	print(x, i)
for i in range(y - 1, 0, -1):
	print(x, i)
zero = True
for line in range(1, n + 1):
	if line == x:
		continue
	if zero:
		for i in range(1, m + 1):
			print(line, i)
	else:
		for i in range(m, 0, -1):
			print(line, i)
	zero = not zero


(n, m, sx, sy) = list(map(int, input().split()))
print(sx, sy)
print(1, sy)
for i in range(1, n + 1):
	l = []
	for j in range(1, m + 1):
		if i == sx and j == sy:
			continue
		elif i == 1 and j == sy:
			continue
		elif i % 2 != 0:
			print('%d %d' % (i, j))
		elif i % 2 == 0:
			co = 0
			while m >= 1:
				if i == sx and m == sy:
					m -= 1
					co += 1
					continue
				else:
					print(i, m)
					m -= 1
					co += 1
			m = co
			break


(n, m, x, y) = map(int, input().split(' '))
origx = x
ans = []
print(*[x, y])
for i in range(y + 1, m + 1):
	print(*[x, i])
i = y - 1
while i > 0:
	print(*[x, i])
	i -= 1
y = 1
while x > 1:
	x -= 1
	if y == 1:
		while y < m + 1:
			print(*[x, y])
			y += 1
		y = m
	else:
		while y > 0:
			print(*[x, y])
			y -= 1
		y = 1
x = origx + 1
while x < n + 1:
	if y == 1:
		while y < m + 1:
			print(*[x, y])
			y += 1
		y = m
	else:
		while y > 0:
			print(*[x, y])
			y -= 1
		y = 1
	x += 1


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

def solveVertical(n, m, sx, sy):
	print(sx, sy)
	for i in range(1, sx):
		print(i, sy)
	for i in range(sx + 1, n + 1):
		print(i, sy)

def solveUp(n, m, sx, sy):
	print(sx, sy)
	for i in range(sx - 1, 0, -1):
		print(i, sy)

def solveDown(n, m, sx, sy):
	print(sx, sy)
	for i in range(sx + 1, n + 1):
		print(i, sy)
up = True
solveVertical(n, m, sx, sy)
sx = n
sy = 1
for i in range(1, m + 1):
	if sy == initY:
		sy += 1
		continue
	if up:
		solveUp(n, m, sx, sy)
		sx = 1
		sy += 1
	else:
		solveDown(n, m, sx, sy)
		sx = n
		sy += 1
	up = not up


(n, m, y, x) = map(int, input().split())
print(str(y) + ' ' + str(x))
if x == 1:
	for i in range(m - 1):
		print(str(y) + ' ' + str(i + 2))
	for i in range(m):
		print('1 ' + str(m - i))
	q = 1
	w = 2
	c = 1
else:
	for i in range(m):
		if m - i != x:
			print(str(y) + ' ' + str(m - i))
	w = 1
	q = 1
	c = 1
for i in range(n * m):
	if q > m or q < 1:
		c *= -1
		q += c
		w += 1
		if w > n:
			break
	if w != y:
		print(str(w) + ' ' + str(q))
	else:
		w += 1
		print(str(w) + ' ' + str(q))
	q += c


(n, m, y, x) = map(int, input().split())
ans = []
ans.append((y, x))
ans.append((1, x))
for i in range(1, n + 1):
	if i & 1:
		for j in range(1, m + 1):
			if i == y and j == x or (i == 1 and j == x):
				continue
			ans.append((i, j))
	else:
		for j in range(m, 0, -1):
			if i == y and j == x or (i == 1 and j == x):
				continue
			ans.append((i, j))
for i in ans:
	print(*i)


(n, m, X, Y) = map(int, input().split())
I = 0
print(X, Y)
for y in range(m):
	if y != Y - 1:
		print(X, y + 1)
for x in range(n):
	if x == X - 1:
		continue
	for y in range(m):
		if I == 0:
			print(x + 1, m - y)
		else:
			print(x + 1, y + 1)
	I = (I + 1) % 2


(n, m, a, b) = map(int, input().split())
x = a
y = b
cnt = 0
flag = 0
for i in range(b):
	print(a, b - i)
	cnt += 1
if cnt == m:
	fl = 1
for i in range(m - cnt):
	print(a, b + 1 + i)
	flag = 1
if flag == 1:
	fl = m
if a != 1:
	for j in range(a - 1):
		if fl == m:
			for i in range(m):
				print(a - 1 - j, m - i)
			fl = 1
		elif fl == 1:
			for i in range(m):
				print(a - 1 - j, i + 1)
			fl = m
	cntx = a
else:
	cntx = 1
for j in range(n - cntx):
	if fl == m:
		for i in range(m):
			print(a + 1 + j, m - i)
		fl = 1
	elif fl == 1:
		for i in range(m):
			print(a + 1 + j, i + 1)
		fl = m


import sys
input = sys.stdin.readline
(n, m, x, y) = map(int, input().split())
grid = [[0] * (m + 1) for i in range(n + 1)]
c = 1
for i in range(x, n + 1):
	print(i, y)
	grid[i][y] = c
	c += 1
for i in range(x - 1, 0, -1):
	print(i, y)
	grid[i][y] = c
	c += 1
s = False
if i == n:
	s = True
cnt = 0
for j in range(y + 1, m + 1):
	cnt += 1
	if s:
		if cnt % 2:
			for i in range(n, 0, -1):
				print(i, j)
				grid[i][j] = c
				c += 1
		else:
			for i in range(1, n + 1):
				print(i, j)
				grid[i][j] = c
				c += 1
	elif cnt % 2:
		for i in range(1, n + 1):
			print(i, j)
			grid[i][j] = c
			c += 1
	else:
		for i in range(n, 0, -1):
			print(i, j)
			grid[i][j] = c
			c += 1
s = False
if i == n:
	s = True
cnt = 0
for j in range(1, y):
	cnt += 1
	if s:
		if cnt % 2:
			for i in range(n, 0, -1):
				print(i, j)
				grid[i][j] = c
				c += 1
		else:
			for i in range(1, n + 1):
				print(i, j)
				grid[i][j] = c
				c += 1
	elif cnt % 2:
		for i in range(1, n + 1):
			print(i, j)
			grid[i][j] = c
			c += 1
	else:
		for i in range(n, 0, -1):
			print(i, j)
			grid[i][j] = c
			c += 1


(m, n, a, b) = map(int, input().split())
print(a, b)
y = b
x = 1
while x < m + 1:
	if x == a:
		x += 1
		continue
	else:
		print(x, y)
		x += 1
x -= 1
y = 1
c = 1
while y < n + 1:
	if y == b:
		y += 1
	elif x == 0:
		x = 1
		y += 1
		c += 1
	elif x == m + 1:
		x = m
		y += 1
		c += 1
	else:
		print(x, y)
		if c % 2 == 0:
			x += 1
		else:
			x -= 1


(n, m, sx, sy) = map(int, input().split())
print(sx, sy)
ok = False
ans = [0] * n
cnt = [0] * m
cnt[sy - 1] += 1
cur = sx
pos = sy
for i in range(n * m - 1):
	if len(set(cnt)) == 1 and cnt[0] == 1:
		ans[cur - 1] += 1
		cur = ans.index(0) + 1
		cnt = [0] * m
		ok = True
	if not ok:
		pos = cnt.index(0) + 1
	else:
		ok = False
	print(cur, pos)
	cnt[pos - 1] += 1


(n, m, sx, sy) = map(int, input().split())
N = list(range(n))
M = list(range(m))
print(sx, sy)
import copy
tempN = copy.deepcopy(N)
tempN.remove(sx - 1)
tempM = copy.deepcopy(M)
tempM.remove(sy - 1)
sx -= 1
sy -= 1
while True:
	if len(tempM) == 0:
		break
	sy = tempM.pop(0)
	print(sx + 1, sy + 1)
while True:
	sx = tempN.pop(0)
	tempM = copy.deepcopy(M)
	tempM.remove(sy)
	print(sx + 1, sy + 1)
	while True:
		if len(tempM) == 0:
			break
		sy = tempM.pop(0)
		print(sx + 1, sy + 1)
	if len(tempN) == 0:
		break


(n, m, x, y) = map(int, input().split())
mat = [['0' for q in range(m)] for w in range(n)]
mat[x - 1][y - 1] = 'x'
i = x - 1
j = y - 1
while i < n:
	print(i + 1, j + 1)
	mat[i][j] = 'x'
	i += 1
i -= 1
while i >= 0:
	if mat[i][j] != 'x':
		print(i + 1, j + 1)
		mat[i][j] = 'x'
		i -= 1
	else:
		i -= 1
i += 1
while j < m:
	if mat[i][j] != 'x':
		print(i + 1, j + 1)
		mat[i][j] = 'x'
		j += 1
	else:
		j += 1
j -= 1
while j >= 0:
	if mat[i][j] != 'x':
		print(i + 1, j + 1)
		mat[i][j] = 'x'
		j -= 1
	else:
		j -= 1
j += 1
srow = 1
endrow = n - 1
startcol = 0
endcol = m - 1
while srow <= endrow and startcol <= endcol:
	for j in range(startcol, endcol + 1):
		if mat[srow][j] != 'x':
			print(srow + 1, j + 1)
	srow += 1
	for i in range(srow, endrow + 1):
		if mat[i][endcol] != 'x':
			print(i + 1, endcol + 1)
	endcol -= 1
	if endrow >= srow:
		for j in range(endcol, startcol - 1, -1):
			if mat[endrow][j] != 'x':
				print(endrow + 1, j + 1)
	endrow -= 1
	if endcol >= startcol:
		for i in range(endrow, srow - 1, -1):
			if mat[i][startcol] != 'x':
				print(i + 1, startcol + 1)
	startcol += 1


(n, m, s_x, s_y) = map(int, input().split())
print(s_x, s_y)
flag = 0
for i in range(s_x, n + 1):
	for j in range(1, m + 1):
		if i == s_x and j == s_y:
			continue
		elif flag == 0:
			print(i, j)
		elif flag == 1:
			print(i, m - j + 1)
	flag = not flag
for i in range(1, s_x):
	for j in range(1, m + 1):
		if flag == 0:
			print(i, j)
		elif flag == 1:
			print(i, m - j + 1)
	flag = not flag


import time, math as mt, bisect as bs, sys
from sys import stdin, stdout
from collections import defaultdict
from collections import deque
from fractions import Fraction
from collections import Counter
from collections import OrderedDict
pi = 3.141592653589793

def II():
	return int(stdin.readline())

def IO():
	return stdin.readline()

def IP():
	return map(int, stdin.readline().split())

def L():
	return list(map(int, stdin.readline().split()))

def P(x):
	return stdout.write(str(x) + '\n')

def PI(x, y):
	return stdout.write(str(x) + ' ' + str(y) + '\n')

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

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

def readTree():
	v = int(input())
	adj = [set() for i in range(v + 1)]
	for i in range(v - 1):
		(u1, u2) = In()
		adj[u1].add(u2)
		adj[u2].add(u1)
	return (adj, v)

def bfs(adj, v):
	visited = [False] * (v + 1)
	q = deque()
	while q:
		pass

def sieve():
	li = [True] * 1000001
	(li[0], li[1]) = (False, False)
	for i in range(2, len(li), 1):
		if li[i] == True:
			for j in range(i * i, len(li), i):
				li[j] = False
	prime = []
	for i in range(1000001):
		if li[i] == True:
			prime.append(i)
	return prime

def setBit(n):
	count = 0
	while n != 0:
		n = n & n - 1
		count += 1
	return count
mx = 10 ** 7
spf = [mx] * (mx + 1)

def SPF():
	spf[1] = 1
	for i in range(2, mx + 1):
		if spf[i] == mx:
			spf[i] = i
			for j in range(i * i, mx + 1, i):
				if i < spf[j]:
					spf[j] = i
	return
mod = 10 ** 9 + 7

def solve():
	(n, m, x, y) = IP()
	for i in range(y, m + 1):
		print(x, i)
	for i in range(y - 1, 0, -1):
		print(x, i)
	for i in range(1, n + 1):
		if i < x:
			if i % 2:
				for j in range(1, m + 1):
					print(i, j)
			else:
				for j in range(m, 0, -1):
					print(i, j)
		elif i > x:
			if i % 2 == 0:
				for j in range(1, m + 1):
					print(i, j)
			else:
				for j in range(m, 0, -1):
					print(i, j)
	return
t = 1
for i in range(t):
	solve()


(n, m, Sx, Sy) = map(int, input().split())
print(Sx, end=' ')
print(Sy)
posx = Sx
posy = 1
print(posx, end=' ')
print(posy)
for i in range(1, m + 1):
	if i % 2 != 0:
		for j in range(1, n + 1):
			posx = j
			posy = i
			if posx == Sx and posy == Sy or (posx == Sx and posy == 1):
				pass
			else:
				print(posx, end=' ')
				print(posy)
	else:
		for j in range(n, 0, -1):
			posx = j
			posy = i
			if posx == Sx and posy == Sy or (posx == Sx and posy == 1):
				pass
			else:
				print(posx, end=' ')
				print(posy)


(N, M, X, Y) = map(int, input().split())
paths = []
for r in range(N):
	if r % 2 == 0:
		for c in range(1, M):
			paths.append((r, c))
	else:
		for c in range(M - 1, 0, -1):
			paths.append((r, c))
for r in range(N - 1, -1, -1):
	paths.append((r, 0))
m = paths.index((X - 1, Y - 1))
print('\n'.join(['{} {}'.format(r + 1, c + 1) for (r, c) in paths[m:]]))
print('\n'.join(['{} {}'.format(r + 1, c + 1) for (r, c) in paths[:m]]))


inputs_list = list(map(int, input().split()))
n = inputs_list[0]
m = inputs_list[1]
sx = inputs_list[2]
sy = inputs_list[3]
x = sy
y = sx
arr = []
arr.append((y, x))
for j in range(sx, 0, -1):
	y = j
	if x == sy:
		for i in range(1, sy):
			arr.append((y, i))
			x = i
		for i in range(sy + 1, m + 1):
			arr.append((y, i))
			x = i
	elif x == m:
		for i in range(m, 0, -1):
			arr.append((y, i))
			x = i
	elif x == 1:
		for i in range(1, m + 1):
			arr.append((y, i))
			x = i
for j in range(sx + 1, n + 1):
	y = j
	if x == sy:
		for i in range(1, sy):
			arr.append((y, i))
			x = i
		for i in range(sy + 1, m + 1):
			arr.append((y, i))
			x = i
	elif x == m:
		for i in range(m, 0, -1):
			arr.append((y, i))
			x = i
	elif x == 1:
		for i in range(1, m + 1):
			arr.append((y, i))
			x = i
for r in arr:
	print(r[0], r[1])


(n, m, x, y) = map(int, input().split())
print(x, y)
print(1, y)
for r in range(1, n + 1):
	if r % 2 == 1:
		for c in range(1, m + 1):
			if r == 1 and c == y:
				continue
			if r == x and c == y:
				continue
			print(r, c)
	else:
		for c in range(m, 0, -1):
			if r == x and c == y:
				continue
			print(r, c)


temparr = input()
temparr = temparr.split()
n = int(temparr[0])
m = int(temparr[1])
x1 = int(temparr[2]) - 1
y1 = int(temparr[3]) - 1
col = [0] * m
rowvisited = [0] * n
visited = [col[:] for _ in range(n)]
dicts = {}
visited[x1][y1] = 1
print(str(x1 + 1) + ' ' + str(y1 + 1))
prevx = x1
prevy = y1
for i in range(m):
	if visited[x1][i] == 1:
		continue
	else:
		print(str(x1 + 1) + ' ' + str(i + 1))
		prevx = x1
		prevy = i
rowvisited[x1] = 1
for i in range(n):
	if rowvisited[i] == 1:
		continue
	prevx = i
	x1 = i
	print(str(x1 + 1) + ' ' + str(prevy + 1))
	visited[x1][prevy] = 1
	for i in range(m):
		if visited[x1][i] == 1:
			continue
		else:
			print(str(x1 + 1) + ' ' + str(i + 1))
			prevx = x1
			prevy = i
			visited[prevx][prevy] = 1
	rowvisited[x1] = 1


(n, m, sx, sy) = map(int, input().split())
(x, y) = (sx, sy)
if x % 2 == 0:
	print(x, y)
	y1 = y
	for i in range(m - y1 - 1):
		y += 1
		print(x, y)
	y = sy
	y1 = y
	for i in range(y1 - 1):
		y -= 1
		if y != y1:
			print(x, y)
	x1 = x
	for i in range(x1 - 1):
		x -= 1
		print(x, y)
		if y == 1:
			for j in range(m - 1):
				y += 1
				print(x, y)
		else:
			for j in range(m - 1):
				y -= 1
				print(x, y)
	x = x1
	print(x, y)
	for i in range(n - x1):
		x += 1
		print(x, y)
		if y == 1:
			for j in range(m - 1):
				y += 1
				print(x, y)
		else:
			for j in range(m - 1):
				y -= 1
				print(x, y)
else:
	print(x, y)
	y1 = y
	for i in range(y1 - 1):
		y -= 1
		print(x, y)
	y = sy
	y1 = y
	for i in range(m - y1):
		y += 1
		if y != y1:
			print(x, y)
	x1 = x
	for i in range(x1 - 1):
		x -= 1
		print(x, y)
		if y == 1:
			for j in range(m - 1):
				y += 1
				print(x, y)
		else:
			for j in range(m - 1):
				y -= 1
				print(x, y)
	x = x1
	for i in range(n - x1):
		x += 1
		print(x, y)
		if y == 1:
			for j in range(m - 1):
				y += 1
				print(x, y)
		else:
			for j in range(m - 1):
				y -= 1
				print(x, y)


(n, m, sx, sy) = input().split()
n = int(n)
m = int(m)
sx = int(sx)
sy = int(sy)
print(str(sx) + ' ' + str(sy))
print('1' + ' ' + str(sy))
for i in range(sy + 1, m + 1):
	print('1' + ' ' + str(i))
for i in range(1, sy):
	print('1' + ' ' + str(sy - i))
for i in range(2, n + 1):
	if i % 2 == 0:
		for j in range(1, m + 1):
			if i != sx or j != sy:
				print(str(i) + ' ' + str(j))
	if i % 2 == 1:
		for j in range(1, m + 1):
			if i != sx or m + 1 - j != sy:
				print(str(i) + ' ' + str(m + 1 - j))


import sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
for tc in range(1):
	(n, m, x, y) = I()
	ans = [[0] * m for i in range(n)]
	ans[x - 1][y - 1] = 1
	i = x - 1
	j = y - 1
	cnt = 2

	def ch(a, b):
		for i in range(m):
			if ans[a][i] == 0:
				return 'row'
		for j in range(n):
			if ans[j][b] == 0:
				return 'col'
		return 0
	an = [[x, y]]
	while 1:
		check = ch(i, j)
		if not check:
			break
		else:
			(ii, jj) = (i, j)
			if check == 'row':
				for k in range(m):
					if ans[i][k] == 0:
						an.append([i + 1, k + 1])
						ans[i][k] = cnt
						j = k
						cnt += 1
			elif check == 'col':
				for k in range(n):
					if ans[k][j] == 0:
						i = k
						an.append([k + 1, j + 1])
						ans[k][j] = cnt
						cnt += 1
			else:
				break
	for i in an:
		print(*i)


def solve(n, m, sx, sy):
	print(sx, sy)
	print(1, sy)
	for x in range(1, n + 1):
		for i in range(1, m + 1):
			if x % 2 == 1:
				y = i
			else:
				y = m - i + 1
			if (x, y) == (1, sy):
				continue
			if (x, y) == (sx, sy):
				continue
			print(x, y)
(n, m, sx, sy) = [int(x) for x in input().split()]
solve(n, m, sx, sy)


(n, m, x, y) = list(map(int, input().split()))
point = []
for i in range(1, n + 1):
	if i & 1:
		for j in range(1, m + 1):
			point.append((i, j))
	else:
		for j in range(m, 0, -1):
			point.append((i, j))
point.remove((1, 1))
point.remove((1, y))
point.remove((x, y))
point.insert(0, (1, 1))
point.insert(0, (1, y))
point.insert(0, (x, y))
for i in point:
	print(*i)


from sys import stdin, stdout
from math import gcd, sqrt, factorial
from collections import deque, defaultdict
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\n')
L = lambda : list(R())
P = lambda x: stdout.write(x)
lcm = lambda x, y: x * y // gcd(x, y)
hg = lambda x, y: (y + x - 1) // x * x
pw = lambda x: 0 if x == 1 else 1 + pw(x // 2)
chk = lambda x: chk(x // 2) if not x % 2 else True if x == 1 else False
sm = lambda x: (x ** 2 + x) // 2
N = 10 ** 9 + 7
(r, c, x, y) = R()
a = [[(x, i + 1) for i in range(c) if i != y - 1]]
a[0] = [(x, y)] + a[0]
for i in range(x + 1, r + 1):
	a += [[(i, j + 1) for j in range(c)]]
for i in range(1, x):
	a += [[(i, j + 1) for j in range(c)]]
pst = a[0][0][-1]
for i in a:
	if i[0][-1] != pst:
		i = i[::-1]
	pst = i[-1][-1]
	for el in i:
		print(*el)


mod = 10 ** 9 + 7

def solve():
	(n, m, x, y) = map(int, input().split())
	for i in range(n):
		for j in range(m):
			print(x, y)
			if j + 1 == m:
				continue
			y = y + 1
			if y > m:
				y = 1
		x = x + 1
		if x > n:
			x = 1
t = 1
for _ in range(t):
	solve()


def colo(r, c, start):
	i = start + 1
	while i <= c:
		print(r, i)
		i += 1
	i = start - 1
	while i >= 1:
		print(r, i)
		i -= 1
	if start == 1:
		return c
	else:
		return 1
(n, m, x, y) = map(int, input().split())
i = 1
visited = [0] * (n + 1)
fill = 0
while fill < n:
	print(x, y)
	visited[x] = 1
	fill += 1
	start = colo(x, m, y)
	for j in range(1, n + 1):
		if visited[j] == 0:
			print(j, start)
			fill += 1
			visited[j] = 1
			start = colo(j, m, start)


from collections import Counter
import heapq
from collections import Counter
(n, m, s1, s2) = map(int, input().split())
print(s1, s2)
for i in range(m):
	if i == s2 - 1:
		continue
	print(s1, i + 1)
f = 1
for i in range(s1 - 2, -1, -1):
	if f == 1:
		for j in range(m, 0, -1):
			print(i + 1, j)
		f = 0
	else:
		for j in range(1, m + 1):
			print(i + 1, j)
		f = 1
for i in range(s1, n):
	if f == 0:
		for j in range(m):
			print(i + 1, j + 1)
		f = 1
	else:
		for j in range(m, 0, -1):
			print(i + 1, j)
		f = 0


(x, y, x0, y0) = map(int, input().split())
print(x0, y0)
print(1, y0)
print(1, 1)
no = [(x0, y0), (1, y0), (1, 1)]
ltor = True
for a in range(1, x + 1):
	if ltor:
		for b in range(1, y + 1):
			if (a, b) not in no:
				print(a, b)
	else:
		for b in range(y, 0, -1):
			if (a, b) not in no:
				print(a, b)
	ltor = not ltor


def solve(m, n, r, c):
	(r1, c1) = ver(r, c, n, m)
	rg = n
	if r1 == n:
		rg = r
	ver(r1, c - 1, rg, 1)
	ver(r - 1, 1, 1, m)

def ver(r, c, rg, cg):
	if rg - r < 0:
		rs = -1
	else:
		rs = 1
	if cg - c < 0:
		cs = -1
	else:
		cs = 1
	cn = c
	rn = r
	while cn != cg + cs:
		rn = r
		while rn != rg + rs:
			print(rn, cn)
			rn += rs
		tmp = rg
		rg = r
		r = tmp
		rs *= -1
		cn += cs
	return (r, cg)
(n, m, r, c) = [int(X) for X in input().strip().split()]
solve(m, n, r, c)


(n, m, x, y) = map(int, input().split())
lastStop = y
stop = 1
print(x, y)
for j in range(1, m + 1):
	if j == stop or j == lastStop:
		continue
	print(x, j)
print(x, stop)
lastStop = stop
for i in range(1, n + 1):
	if i == x:
		continue
	print(i, lastStop)
	stop = (stop + 1) % m + 1
	for j in range(1, m + 1):
		if j == stop or j == lastStop:
			continue
		print(i, j)
	print(i, stop)
	lastStop = stop


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


(x, y, Sx, Sy) = map(int, input().split())
print(Sx, Sy)
for i in range(1, x + 1):
	if i != Sx:
		print(i, Sy)
for i in range(x):
	print(x - i, 1)
cnt = 1
for j in range(2, y + 1):
	if j != Sy and cnt == 1:
		for i in range(1, x + 1):
			print(i, j)
			cnt = 0
	elif j != Sy and cnt == 0:
		for i in range(x):
			print(x - i, j)
			cnt = 1


import sys, io, os, time
from collections import defaultdict
from collections import OrderedDict
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect, math, heapq
alphabet = 'abcdefghijklmnopqrstuvwxyz'
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 5)
(n, m, x, y) = map(int, input().split())
visited = [[False] * (m + 1) for i in range(n + 1)]
for i in range(y, 0, -1):
	print(x, i)
	visited[x][i] = True
for j in range(y + 1, m + 1):
	print(x, j)
	visited[x][j] = True
f = 1
for i in range(x + 1, n + 1):
	if f:
		for j in range(m, 0, -1):
			print(i, j)
			visited[i][j] = True
	else:
		for j in range(1, m + 1):
			print(i, j)
			visited[i][j] = True
	f = not f
for i in range(x - 1, 0, -1):
	if not f:
		for j in range(1, m + 1):
			print(i, j)
			visited[i][j] = True
	else:
		for j in range(m, 0, -1):
			print(i, j)
			visited[i][j] = True
	f = not f


(a, b, x, y) = map(int, input().split())
ans1 = x
ans2 = y
for x in range(a):
	if ans1 > a:
		ans1 = ans1 - a
	for x in range(b):
		if ans2 > b:
			ans2 = ans2 - b
		print(f'{ans1} {ans2}')
		ans2 = ans2 + 1
	ans1 = ans1 + 1
	ans2 = ans2 - 1


def Chess_Board(N, M, X, Y):
	Visited = []
	(x, y) = (X, Y)
	while y >= 1:
		Visited.append((x, y))
		y -= 1
	y = Y + 1
	while y <= M:
		Visited.append((x, y))
		y += 1
	(x, y) = (X + 1, M)
	if X == N:
		(x, y) = (X - 1, M)
	while x <= N and x >= 1 and (y >= 1) and (y <= M):
		if y == M:
			while y >= 1:
				Visited.append((x, y))
				y -= 1
			(x, y) = (x, 1)
		elif y == 1:
			while y <= M:
				Visited.append((x, y))
				y += 1
			(x, y) = (x, M)
		if x < X:
			x -= 1
		else:
			x += 1
		if x > N:
			if X == 1:
				break
			x = X - 1
	return Visited

def main():
	(n, m, x1, y1) = map(int, input().split())
	Visi = Chess_Board(n, m, x1, y1)
	for tup in Visi:
		print(tup[0], tup[1])
main()


def solve(n, m, x, y):
	avoid = [[x, y], [1, y]]
	print(x, y)
	print(1, y)
	for i in range(1, n + 1):
		if i % 2 == 1:
			for j in range(1, m + 1):
				cell = [i, j]
				if cell not in avoid:
					print(i, j)
		else:
			for j in range(m, 0, -1):
				cell = [i, j]
				if cell not in avoid:
					print(i, j)
(n, m, x, y) = map(int, input().split())
solve(n, m, x, y)


(n, m, h, k) = map(int, input().split())
for x in range(k, m + 1):
	print(h, x)
for x in range(k - 1, 0, -1):
	print(h, x)
f = h - 1
y = 1
while f != 0:
	if y == m + 1:
		for y in range(m, 0, -1):
			print(f, y)
		y = 1
	elif y == 1:
		for y in range(1, m + 1):
			print(f, y)
		y = m + 1
	f -= 1
f = h + 1
while f != n + 1:
	if y == m + 1:
		for y in range(m, 0, -1):
			print(f, y)
		y = 1
	elif y == 1:
		for y in range(1, m + 1):
			print(f, y)
		y = m + 1
	f += 1


(n, m, x, y) = map(int, input().split())
anz = [[x, y], [1, y]]
d = {(x, y): 1, (1, y): 1}
for i in range(1, n + 1):
	if i & 1:
		for j in range(1, m + 1):
			if (i, j) not in d:
				anz.append([i, j])
				d[i, j] = 1
	else:
		for j in range(m, 0, -1):
			if (i, j) not in d:
				anz.append([i, j])
				d[i, j] = 1
for i in anz:
	print(*i)


import os
import heapq
import sys, threading
import math
import bisect
import operator
from collections import defaultdict
sys.setrecursionlimit(10 ** 5)
from io import BytesIO, IOBase

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

def power(x, p, m):
	res = 1
	while p:
		if p & 1:
			res = res * x % m
		x = x * x % m
		p >>= 1
	return res

def inar():
	return [int(k) for k in input().split()]

def lcm(num1, num2):
	return num1 * num2 // gcd(num1, num2)

def main():
	t = 1
	for _ in range(t):
		(n, m, x, y) = inar()
		res = []
		i = x
		count1 = 0
		take = y
		ok = 0
		while i <= n and count1 < n:
			count2 = 0
			if ok == 0:
				ok = 1
				j = y
			else:
				j = take
			while j <= m and count2 < m:
				res.append([i, j])
				if j == m:
					j = 1
					count2 += 1
				else:
					count2 += 1
					j += 1
			if j == 1:
				take = m
			else:
				take = j - 1
			if i == n:
				count1 += 1
				i = 1
			else:
				i += 1
				count1 += 1
		for i in range(len(res)):
			print(*res[i])
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import math
import sys
import bisect
input = sys.stdin.readline
t = 1
for _ in range(t):
	(n, m, x, y) = map(int, input().split())
	vis = [[0 for j in range(m + 1)] for i in range(n + 1)]
	print(x, y)
	vis[x][y] = 1
	print(1, y)
	vis[1][y] = 1
	ch = 0
	for i in range(1, n + 1):
		if ch % 2 == 0:
			for j in range(1, m + 1):
				if vis[i][j] == 0:
					print(i, j)
					vis[i][j] = 1
			ch += 1
		else:
			for j in range(m, 0, -1):
				if vis[i][j] == 0:
					print(i, j)
					vis[i][j] = 1
			ch += 1


(n, m, sx, sy) = map(int, input().split())
res = [[0 for i in range(m + 1)] for i in range(n + 1)]
res[sx][sy] = 1
print(sx, sy)
sy = 1
res[sx][sy] = 1
print(sx, sy)
sx = 1
res[sx][sy] = 1
print(sx, sy)

def recSolve(sx, sy):
	ny = sy
	for i in range(1, m + 1):
		if res[sx][i] == 0:
			res[sx][i] = 1
			print(sx, i)
			ny = i
	if sx != n:
		if res[sx + 1][ny] == 0:
			res[sx + 1][ny] = 1
			print(sx + 1, ny)
			recSolve(sx + 1, ny)
		elif res[sx + 1][ny] == 1:
			res[sx + 2][ny] = 1
			print(sx + 2, ny)
			recSolve(sx + 2, ny)
			res[sx + 1][m] = 1
			print(sx + 1, m)
			for i in range(1, m + 1):
				if res[sx + 1][i] == 0:
					res[sx + 1][i] = 1
					print(sx + 1, i)
	else:
		return
recSolve(sx, sy)


from collections import defaultdict
(m, n, sx, sy) = map(int, input().split())
ans = [(sx, sy)]
d = defaultdict(int)
for i in range(n, 0, -1):
	if i != sy:
		ans.append((sx, i))
flag = 1
for i in range(1, m + 1):
	if i != sx:
		if flag:
			for j in range(1, n + 1):
				ans.append((i, j))
			flag = 0
		else:
			for j in range(n, 0, -1):
				ans.append((i, j))
			flag = 1
for i in ans:
	print(*i)


(n, m, sx, sy) = map(int, input().split())
sx -= 1
sy -= 1
path = []
path.append((sx, sy))
path.append((0, sy))
for i in range(n):
	for j in range(m):
		cell = (i, j) if i % 2 == 0 else (i, m - j - 1)
		if cell != (sx, sy) and cell != (0, sy):
			path.append(cell)
for cell in path:
	print(cell[0] + 1, cell[1] + 1)


(n, m, x, y) = map(int, input().split())
l = [(x, y)]
p = y - 1
u = x - 1
x = x + 1
while x <= n:
	l.append((x, y))
	x = x + 1
while u >= 1:
	l.append((u, y))
	u = u - 1
i = y + 1
while i <= m:
	s = l[-1]
	if s[0] == 1:
		j = 1
		while j <= n:
			l.append((j, i))
			j = j + 1
	else:
		j = n
		while j >= 1:
			l.append((j, i))
			j = j - 1
	i = i + 1
i = p
while i >= 1:
	s = l[-1]
	if s[0] == 1:
		j = 1
		while j <= n:
			l.append((j, i))
			j = j + 1
	else:
		j = n
		while j >= 1:
			l.append((j, i))
			j = j - 1
	i = i - 1
for i in l:
	print(i[0], i[1])


def main():
	(n, m, x, y) = map(int, input().split())
	print(x, y)
	for i in range(1, n + 1):
		if i != x:
			print(i, y)
	dir = 0
	for i in range(1, m + 1):
		if i == y:
			continue
		if dir == 0:
			print(n, i)
			for j in range(n - 1, 0, -1):
				print(j, i)
			dir = 1
		else:
			print(1, i)
			for j in range(2, n + 1):
				print(j, i)
			dir = 0
main()


def next_ints():
	return [int(x) for x in input().split()]
(n, m, x, y) = next_ints()
start_x = x
start_y = y
print(x, y)
for i in range(1, n + 1):
	if i == start_x:
		continue
	print(i, y)
visited = 1
for j in range(1, m + 1):
	if j == start_y:
		continue
	if visited % 2 == 0:
		for i in range(1, n + 1):
			print(i, j)
	else:
		for i in range(n, 0, -1):
			print(i, j)
	visited += 1


def empty(x, y):
	pass
(n, m, sx, sy) = map(int, input().split())
print(sx, sy)
print(sx, 1)
for y in range(1, m + 1):
	if y % 2 == 0:
		for x in range(1, n + 1):
			do = print if (x != sx or y != sy) and (x != sx or y != 1) else empty
			do(x, y)
	else:
		for x in range(n, 0, -1):
			do = print if (x != sx or y != sy) and (x != sx or y != 1) else empty
			do(x, y)


import sys
import math
from collections import defaultdict, Counter
(n, m, sx, sy) = map(int, input().split())
curr = sx
while curr >= 1:
	print(curr, sy)
	curr -= 1
curr = sx + 1
while curr <= n:
	print(curr, sy)
	curr += 1
flag = 0
for j in range(sy + 1, m + 1):
	if flag == 0:
		for k in range(n, 0, -1):
			print(k, j)
		flag = 1
	else:
		for k in range(1, n + 1):
			print(k, j)
		flag = 0
for j in range(sy - 1, 0, -1):
	if flag == 0:
		for k in range(n, 0, -1):
			print(k, j)
		flag = 1
	else:
		for k in range(1, n + 1):
			print(k, j)
			flag = 0


import sys

def solve(n, m, sx, sy):
	sx -= 1
	sy -= 1
	ans = []

	def doRow(row, startColumn, ans):
		for i in range(startColumn, n):
			ans.append((i, row))
		for i in range(startColumn - 1, -1, -1):
			ans.append((i, row))
		return ans[-1][0]
	curRow = sy
	curCol = sx
	while curRow >= 0:
		curCol = doRow(curRow, curCol, ans)
		curRow -= 1
	curRow = sy + 1
	while curRow < m:
		curCol = doRow(curRow, curCol, ans)
		curRow += 1
	return ans
x = next(sys.stdin)[:-1].split(' ')
(n, m, sx, sy) = [int(i) for i in x]
ans = solve(n, m, sx, sy)
for i in ans:
	print(i[0] + 1, i[1] + 1)


l = list(map(int, input().split()))
(n, m, x, y) = l
x -= 1
y -= 1
ch = y
lc = [0] * n
lr = [0] * m
fs = x
for i in range(m):
	if lr[y] != 1:
		print(fs + 1, y + 1, sep=' ')
		lc[fs] = 1
		for j in range(n):
			if lc[j] != 1:
				print(j + 1, y + 1, sep=' ')
				fs = j
				lc[j] = 1
	(x, y) = (fs, y)
	lc = [0] * n
	lr[y] = 1
	for jj in range(m):
		if lr[jj] != 1:
			y = jj


import sys

def Ints():
	return map(int, sys.stdin.readline().strip().split())

def Strs():
	return map(str, sys.stdin.readline().strip().split())

def Array():
	return list(map(int, sys.stdin.readline().strip().split()))

def Str():
	return sys.stdin.readline().strip()

def Int():
	return int(sys.stdin.readline().strip())

def MOD():
	return 1000000007
(n, m, x, y) = Ints()
print(x, y)
for i in range(1, n * m):
	if i % n == 0:
		y = y % m + 1
	else:
		x = x % n + 1
	print(x, y)


from sys import stdout
(n, m, sx, sy) = map(int, input().split())
sx -= 1
sy -= 1
ans = ''
cnt = 0
movex = +1
movey = +1
(x, y) = (sx, sy)
f = True
while x < n:
	y = sy
	while y < m:
		ans += f'{x + 1} {y + 1}\n'
		y += 1
	if sy > 0:
		y = sy - 1
		while y >= 0:
			ans += f'{x + 1} {y + 1}\n'
			y -= 1
		sy = 0
	else:
		sy = m - 1
	x += 1
x = sx - 1
while x >= 0:
	y = sy
	while y < m:
		ans += f'{x + 1} {y + 1}\n'
		y += 1
	if sy > 0:
		y = sy - 1
		while y >= 0:
			ans += f'{x + 1} {y + 1}\n'
			y -= 1
		sy = 0
	else:
		sy = m - 1
	x -= 1
stdout.write(ans)


(n, m, sx, sy) = [int(i) for i in input().split()]
flag_end = True
for i in range(sy, 0, -1):
	print(sx, i)
for i in range(sy + 1, m + 1):
	print(sx, i)
for i in range(n, 0, -1):
	if i == sx:
		continue
	elif flag_end == True:
		for j in range(m, 0, -1):
			print(i, j)
		flag_end = False
	else:
		for j in range(1, m + 1):
			print(i, j)
		flag_end = True


MOD = 1000000007
from collections import defaultdict as dd, Counter, deque

def si():
	return input()

def ii():
	return int(input())

def li():
	return list(map(int, input().split()))

def mi():
	return map(int, input().split())

def out(v):
	print(v)

def spout():
	print(v, end=' ')

def d2b(n):
	return bin(n).replace('0b', '')

def twod(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def vow():
	return ['a', 'e', 'i', 'o', 'u']

def let():
	return [chr(i) for i in range(97, 123)]

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def ispow2(x):
	return x and (not x & x - 1)

def prime_factors(n):
	i = 2
	factors = []
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.append(i)
	if n > 1:
		factors.append(n)
	return list(factors)
(n, m, x, y) = mi()
print(x, y)
for cor in range(x + 1, n + 1):
	print(cor, y)
for cor in range(x - 1, 0, -1):
	print(cor, y)
cov = n
i = 0
x_cor = x
y_cor = 1
while cov < n * m:
	if i % 2 == 0:
		for currx in range(1, m + 1):
			if currx == y:
				continue
			print(y_cor, currx)
		i += 1
		y_cor += 1
		cov += m - 1
	else:
		for currx in range(m, 0, -1):
			if currx == y:
				continue
			print(y_cor, currx)
		y_cor += 1
		cov += m - 1
		i += 1


a = list(map(int, input().split(' ')))
n = a[0]
m = a[1]
x = a[2]
y = a[3]
print(x, y)
move = 1
x_start = x
y_start = y
for i in range(n):
	if i == 0:
		x = n
		print(x, y)
		move += 1
		continue
	x -= 1
	if x == x_start:
		continue
	else:
		print(x, y)
		move += 1
y = 1
print(x, y)
move += 1
odd = True
while True:
	if odd is True:
		x += 1
	elif odd is False:
		x -= 1
	if x > n:
		x = n
		y += 1
		if y == y_start:
			y += 1
		odd = False
	elif x < 1:
		x = 1
		y += 1
		if y == y_start:
			y += 1
		odd = True
	print(x, y)
	move += 1
	if move == m * n:
		break


(n, m, Sx, Sy) = map(int, input().split())
for r in range(0, n):
	print(f'{Sx} {Sy}')
	entered_col = Sy
	for c in range(0, m):
		if c + 1 == entered_col:
			continue
		print(f'{Sx} {c + 1}')
		Sy = c + 1
	Sx = Sx % n + 1


(n, m, x, y) = map(int, input().split())
for i in range(n):
	for j in range(m):
		(xx, yy) = ((x + i) % n, (y + j) % m)
		if not xx:
			xx += n
		if not yy:
			yy += m
		print(xx, yy)
	y = yy


(n, m, x, y) = map(int, input().split())
L = [(x, y)]
print(x, y)
for i in range(y, 0, -1):
	print(1, i)
for i in range(y + 1, m + 1):
	print(1, i)
for i in range(2, n + 1):
	if i != x:
		if i % 2 == 0:
			for j in range(m, 0, -1):
				print(i, j)
		else:
			for j in range(1, m + 1):
				print(i, j)
	elif i % 2 == 0:
		for j in list(range(m, y, -1)) + list(range(y - 1, 0, -1)):
			print(i, j)
	else:
		for j in list(range(1, y)) + list(range(y + 1, m + 1)):
			print(i, j)


(m, n, x, y) = list(map(int, input().split()))
seen = set()
count = 0
while x != 1 and y != 1:
	seen.add((x, y))
	print(x, y)
	if x > 1:
		x -= 1
		continue
	if y > 1:
		y -= 1
seen.add((x, y))
print(x, y)
for i in range(1, m + 1):
	if i % 2 == 1:
		for j in range(1, n + 1):
			if (i, j) not in seen:
				seen.add((i, j))
				print(i, j)
	else:
		for j in range(n, 0, -1):
			if (i, j) not in seen:
				seen.add((i, j))
				print(i, j)


from sys import stdin
G = lambda : stdin.readline().strip()
gl = lambda : G().split()
gil = lambda : [int(var) for var in gl()]
t = 1
for _ in range(t):
	(n, m, x, y) = gil()
	grid = [[0 for _ in range(m)] for _ in range(n)]
	print(x, y)
	x -= 1
	y -= 1
	grid[x][y] = 1
	total = n * m
	for cy in range(y + 1, m):
		grid[x][cy] = 1
		print(x + 1, cy + 1)
	for cy in reversed(range(y)):
		grid[x][cy] = 1
		print(x + 1, cy + 1)
	y = m - 1 if y == 0 else 0
	cnt = m
	sign = -1 if y else 1
	while 0 <= y < m:
		last = x
		for cx in range(x, n):
			if grid[cx][y] == 0:
				grid[cx][y] = 1
				last = cx
				print(cx + 1, y + 1)
		for cx in reversed(range(last + 1)):
			if grid[cx][y] == 0:
				grid[cx][y] = 1
				last = cx
				print(cx + 1, y + 1)
		x = last
		y += sign


(n, m, pi, pj) = map(int, input().split())
cnt = -1
for i in range(pi, 0, -1):
	print(i, pj)
for i in range(pi + 1, n + 1):
	print(i, pj)
cnt = 0
for i in range(pj + 1, m + 1):
	if cnt % 2 == 0:
		for j in range(n, 0, -1):
			print(j, i)
	else:
		for j in range(1, n + 1):
			print(j, i)
	cnt += 1
if cnt % 2 == 0:
	snt = 0
	for i in range(pj - 1, 0, -1):
		if snt % 2 == 0:
			for j in range(n, 0, -1):
				print(j, i)
		else:
			for j in range(1, n + 1):
				print(j, i)
		snt += 1
else:
	snt = 0
	for i in range(pj - 1, 0, -1):
		if snt % 2 == 0:
			for j in range(1, n + 1):
				print(j, i)
		else:
			for j in range(n, 0, -1):
				print(j, i)
		snt += 1


(n, m, x, y) = map(int, input().split())
p = x
for i in range(y, m + 1):
	print(x, i)
for i in range(1, y):
	print(x, y - i)
x += 1
while x <= n + 1:
	if x <= n:
		for i in range(m):
			print(x, i + 1)
			kr = i + 1
	if x + 1 <= n:
		for i in range(m):
			print(x + 1, m - i)
			kr = m - i
	x += 2
x = 1
while x < p and kr == 1:
	if x < p:
		for i in range(m):
			print(x, i + 1)
	if x + 1 < p:
		for i in range(m):
			print(x + 1, m - i)
	x += 2
while x < p and kr == m:
	if x < p:
		for i in range(m):
			print(x, m - i)
	if x + 1 < p:
		for i in range(m):
			print(x + 1, i + 1)
	x += 2


l = input().split()
n = int(l[0])
m = int(l[1])
x = int(l[2])
y = int(l[3])
hashi = dict()
hashi[x, y] = 1
print(x, y)
print(1, y)
hashi[1, y] = 1
curr = 0
for i in range(1, n + 1):
	if curr == 0:
		for j in range(1, m + 1):
			if (i, j) not in hashi:
				print(i, j)
		curr = 1
	else:
		for j in range(m, 0, -1):
			if (i, j) not in hashi:
				print(i, j)
		curr = 0


(n, m, x, y) = input().split()
(n, m, x, y) = (int(n), int(m), int(x), int(y))
x -= 1
y -= 1
print(x + 1, '', y + 1)
for j in range(m):
	if j != y:
		print(x + 1, '', j + 1)
		yy = j
y = yy + 1
for i in range(n):
	if i != x:
		j = m
		print(i + 1, '', y)
		while j > 0:
			if j != y:
				print(i + 1, '', j)
				yy = j
			j -= 1
		y = yy


(n, m, a, b) = [int(c) for c in input().split()]
ans = [(a, b)]
for i in range(2, m + 1):
	if i != b:
		ans.append((a, i))
p = a
q = m
for i in range(p - 1, 0, -1):
	ans.append((i, q))
	if q == m:
		for j in range(m - 1, 1, -1):
			ans.append((i, j))
		q = 2
		continue
	elif q == 2:
		for j in range(3, m + 1):
			ans.append((i, j))
		q = m
ans.append((1, 1))
for i in range(2, n + 1):
	ans.append((i, 1))
p = n
q = 2
for i in range(n, a, -1):
	ans.append((i, q))
	if q == 2:
		for j in range(3, m + 1):
			ans.append((i, j))
		q = m
		continue
	elif q == m:
		for j in range(m - 1, 1, -1):
			ans.append((i, j))
		q = 2
for i in ans:
	print(*i)


from sys import stdin, stdout
import bisect
from bisect import bisect_left as bl
from bisect import bisect_right as br
import itertools
from collections import Counter
from math import sqrt
import collections
import math
import heapq
import re

def modinv(n, p):
	return pow(n, p - 2, p)

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())

def Divisors(n):
	l = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l

def most_frequent(list):
	return max(set(list), key=list.count)

def GCD(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def ncr(n, r, p):
	t = fact[n] * (ifact[r] * ifact[n - r] % p) % p
	return t

def Convert(string):
	li = list(string.split(''))
	return li

def SieveOfEratosthenes(n):
	global prime
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	f = []
	for p in range(2, n):
		if prime[p]:
			f.append(p)
	return f
prime = []
q = []

def dfs(n, d, v, c):
	global q
	v[n] = 1
	x = d[n]
	q.append(n)
	j = c
	for i in x:
		if i not in v:
			f = dfs(i, d, v, c + 1)
			j = max(j, f)
	return j

def main():
	(n, m, x, y) = map(int, input().split())
	arr = [[0 for i in range(m)] for j in range(n)]
	arr[x - 1][y - 1] = 1
	for i in range(x):
		print(x - i, y)
		arr[x - i - 1][y - 1] = 1
	for i in range(1, y):
		print(1, y - i)
		arr[0][y - i - 1] = 1
	flag = 0
	for i in range(n):
		if flag == 0:
			for j in range(m):
				if arr[i][j] == 0:
					print(i + 1, j + 1)
					arr[i][j] = 1
			flag = 1
		else:
			for j in range(m - 1, -1, -1):
				if arr[i][j] == 0:
					print(i + 1, j + 1)
					arr[i][j] = 1
			flag = 0
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


line = input().split(' ')
n = int(line[0])
m = int(line[1])
x = int(line[2])
y = int(line[3])
grid = []
for i in range(n):
	temp = []
	for j in range(m):
		temp.append(0)
	grid.append(temp)
grid[x - 1][y - 1] = 1
print(x, y)
total = n * m - 1
hor = True
ver = False
c = -1
r = x
while total > 0:
	if hor:
		for k in range(m):
			if grid[r - 1][k] == 0:
				grid[r - 1][k] = 1
				c = k + 1
				print(r, c)
				total -= 1
		hor = False
		ver = True
	elif ver:
		for j in range(n):
			if grid[j][c - 1] == 0:
				grid[j][c - 1] = 1
				total -= 1
				r = j + 1
				print(r, c)
		hor = True
		ver = False


(n, m, x, y) = [int(x) for x in input().split()]
print('{} {}'.format(x, y))
print('1 {}'.format(y))
for i in range(1, n + 1, 2):
	for j in range(1, m + 1):
		if j == y and i in [1, x]:
			continue
		print('{} {}'.format(i, j))
	for j in range(m, 0, -1):
		if i == n:
			break
		if j == y and i + 1 in [1, x]:
			continue
		print('{} {}'.format(i + 1, j))


from functools import reduce
from collections import Counter
import time
import datetime

def time_t():
	print('Current date and time: ', datetime.datetime.now())
	print('Current year: ', datetime.date.today().strftime('%Y'))
	print('Month of year: ', datetime.date.today().strftime('%B'))
	print('Week number of the year: ', datetime.date.today().strftime('%W'))
	print('Weekday of the week: ', datetime.date.today().strftime('%w'))
	print('Day of year: ', datetime.date.today().strftime('%j'))
	print('Day of the month : ', datetime.date.today().strftime('%d'))
	print('Day of week: ', datetime.date.today().strftime('%A'))

def ip():
	return int(input())

def sip():
	return input()

def mip():
	return map(int, input().split())

def mips():
	return map(str, input().split())

def lip():
	return list(map(int, input().split()))

def matip(n, m):
	lst = []
	for i in range(n):
		arr = lip()
		lst.append(arr)
	return lst

def factors(n):
	return list(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def minJumps(arr, n):
	jumps = [0 for i in range(n)]
	if n == 0 or arr[0] == 0:
		return float('inf')
	jumps[0] = 0
	for i in range(1, n):
		jumps[i] = float('inf')
		for j in range(i):
			if i <= j + arr[j] and jumps[j] != float('inf'):
				jumps[i] = min(jumps[i], jumps[j] + 1)
				break
	return jumps[n - 1]

def dic(arr):
	return Counter(arr)
(n, m, x, y) = mip()
print(x, y)
for i in range(1, m + 1):
	if i != y:
		print(x, i)
count = 0
p = x
while p > 1:
	p -= 1
	if count % 2 == 0:
		count += 1
		for i in range(m, 0, -1):
			print(p, i)
	else:
		count += 1
		for i in range(1, m + 1):
			print(p, i)
p = x
while p < n:
	p += 1
	if count % 2 == 0:
		count += 1
		for i in range(m, 0, -1):
			print(p, i)
	else:
		count += 1
		for i in range(1, m + 1):
			print(p, i)


(n, m, sx, sy) = [int(x) for x in input().split()]
print(sx, sy)
print(1, sy)
a = [[sx, sy], [1, sy]]
for i in range(1, n + 1):
	if i % 2 == 1:
		for j in range(1, m + 1):
			if [i, j] not in a:
				print(i, j)
	if i % 2 == 0:
		for j in range(m, 0, -1):
			if [i, j] not in a:
				print(i, j)


(z, zz) = (input, lambda : list(map(int, z().split())))
(szz, dgraphs, mod) = (lambda : sorted(zz()), {}, 10 ** 9 + 7)
from string import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = True
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)
(n, m, x, y) = zz()

def solve(x, y):
	print(x, y)
	k = y
	for i in range(1, m + 1):
		if i != y:
			k = i
			print(x, i)
	return k
p = solve(x, y)
k = p
for i in range(1, n + 1):
	if i != x:
		p = solve(i, k)
	k = p


import os
import heapq
import sys
import math
import operator
from collections import defaultdict
from io import BytesIO, IOBase

def inpt():
	return [int(k) for k in input().split()]

def main():
	(n, m, a, b) = map(int, input().split())
	print(a, b)
	ans = []
	for i in range(a + 1, n + 1):
		print(i, b)
		ans.append((i, b))
	for i in range(a - 1, 0, -1):
		print(i, b)
		ans.append((i, b))
	ok = False
	for i in range(1, m + 1):
		if i == b:
			ok = True
			continue
		if ok:
			if i % 2 == 0:
				for j in range(1, n + 1):
					print(j, i)
					ans.append((j, i))
			if i % 2 == 1:
				for j in range(n, 0, -1):
					print(j, i)
					ans.append((j, i))
			continue
		if i % 2 == 1:
			for j in range(1, n + 1):
				print(j, i)
				ans.append((j, i))
		if i % 2 == 0:
			for j in range(n, 0, -1):
				print(j, i)
				ans.append((j, i))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


(n, m, setX, setY) = map(int, input().split())
a = [[0 for i in range(m + 1)] for i in range(n + 1)]

def solve(setX, setY):
	preY = setY
	for i in range(1, m + 1):
		if a[setX][i] == 0:
			a[setX][i] = 1
			print(setX, i)
			preY = i
	if setX != n:
		if a[setX + 1][preY] == 0:
			a[setX + 1][preY] = 1
			print(setX + 1, preY)
			solve(setX + 1, preY)
		elif a[setX + 1][preY] == 1:
			a[setX + 2][preY] = 1
			print(setX + 2, preY)
			solve(setX + 2, preY)
			a[setX + 1][m] = 1
			print(setX + 1, m)
			for i in range(1, m + 1):
				if a[setX + 1][i] == 0:
					a[setX + 1][i] = 1
					print(setX + 1, i)
	else:
		return
a[setX][setY] = 1
print(setX, setY)
setY = 1
a[setX][setY] = 1
print(setX, setY)
setX = 1
a[setX][setY] = 1
print(setX, setY)
solve(setX, setY)


(n, m, x, y) = map(int, input().split())
nlist = [x for x in range(1, n + 1)]
mlist = [x for x in range(1, m + 1)]
nlist.reverse()
(prex, prey) = (x, y)
print(prex, prey)
aln = []
aln.append(prex)
for p in range(m):
	for i in nlist:
		if i not in aln:
			print(i, prey)
			prex = i
	mlist.remove(prey)
	try:
		prey = mlist[0]
	except:
		pass
	nlist.reverse()
	aln = []


(n, m, x, y) = map(int, input().split())
(t1, t2) = (y, y + 1)
f1 = 0
c = 0
while t1 > 0:
	print(x, t1)
	t1 -= 1
while t2 <= m:
	print(x, t2)
	t2 += 1
f = 0
temp = x + 1
x -= 1
while x > 0:
	if f == 0:
		t1 = m
		while t1 > 0:
			print(x, t1)
			t1 -= 1
	else:
		t1 = 1
		while t1 <= m:
			print(x, t1)
			t1 += 1
	x -= 1
	f ^= 1
x = temp
while x <= n:
	if f == 0:
		t1 = m
		while t1 > 0:
			print(x, t1)
			t1 -= 1
	else:
		t1 = 1
		while t1 <= m:
			print(x, t1)
			t1 += 1
	x += 1
	f ^= 1


from sys import stdout, stdin
from collections import defaultdict
l = list(map(int, input().split()))
j = l[3]
while j > 0:
	print(l[2], j)
	j -= 1
j = l[3] + 1
while j <= l[1]:
	print(l[2], j)
	j += 1
for i in range(l[0] - l[2]):
	if i % 2 != 0:
		for j in range(1, l[1] + 1):
			print(l[2] + i + 1, j)
	else:
		for j in range(l[1], 0, -1):
			print(l[2] + i + 1, j)
if j == 1:
	for k in range(l[2] - 1):
		if k % 2 == 0:
			for j in range(1, l[1] + 1):
				print(k + 1, j)
		else:
			for j in range(l[1], 0, -1):
				print(k + 1, j)
else:
	for k in range(l[2] - 1):
		if k % 2 != 0:
			for j in range(1, l[1] + 1):
				print(k + 1, j)
		else:
			for j in range(l[1], 0, -1):
				print(k + 1, j)


import sys
INP = lambda : sys.stdin.readline().strip()
INT = lambda : int(INP())
MAP = lambda : map(int, INP().split())
ARR = lambda : [int(i) for i in INP().split()]

def JOIN(arr, x=' '):
	return x.join([str(i) for i in arr])

def EXIT(x='NO'):
	print(x)
	exit()

def solve():
	(n, m, sx, sy) = MAP()
	print(sx, sy)
	(cx, cy) = (sx, sy)
	left = True
	if sy == 1:
		left = False
		while cy < m:
			cy += 1
			print(cx, cy)
	else:
		while cy < m:
			cy += 1
			print(cx, cy)
		cy = sy
		while cy > 1:
			cy -= 1
			print(cx, cy)
	for i in range(sx + 1, n + 1):
		if left:
			for j in range(1, m + 1):
				print(i, j)
			left = False
		else:
			for j in reversed(range(1, m + 1)):
				print(i, j)
			left = True
	for i in range(1, sx):
		if left:
			for j in range(1, m + 1):
				print(i, j)
			left = False
		else:
			for j in reversed(range(1, m + 1)):
				print(i, j)
			left = True
solve()


import math, sys
from collections import defaultdict, Counter, deque
INF = float('inf')
MOD = 1000000007

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

def isPrime(n):
	if n <= 1:
		return False
	i = 2
	while i ** 2 <= n:
		if n % i == 0:
			return False
		i += 1
	return True

def primeFactors(n):
	factors = []
	i = 2
	while i ** 2 <= n:
		while n % i == 0:
			factors.append(i)
			n //= i
		i += 1
	if n > 1:
		factors.append(n)
	return factors

def vars():
	return map(int, input().split())

def array():
	return list(map(int, input().split()))

def a():
	(r, g, b, w) = vars()
	colors = [r, g, b, w]
	odd = 0
	for color in colors:
		if color % 2 == 1:
			odd += 1
	if (r == 0 or g == 0 or b == 0) and odd > 1:
		print('No')
		return
	if colors[-1] % 2 == 1:
		odd -= 1
	if odd == 3:
		print('Yes')
	elif odd == 2 and colors[-1] % 2 == 1:
		print('Yes')
	elif odd == 0 or (odd == 1 and colors[-1] % 2 == 0):
		print('Yes')
	else:
		print('No')

def b():
	(n, m, start, end) = vars()
	visited = {}
	(x, y) = (start, end)
	while x >= 1:
		print(x, y)
		x -= 1
	x += 1
	side = 0
	for x in range(1, n + 1):
		if not side:
			r = (1, m)
		else:
			r = (m, 1, -1)
		for y in range(*r):
			if x <= start and y != end or x > start:
				print(x, y)
		print(x, r[1])
		visited[x, r[1]] = True
		side ^= 1

def most_common_set_bits(n1, n2):
	cnt = 0
	i = min(len(n1), len(n2)) - 1
	while i >= 0:
		if n1[i] == n2[i]:
			cnt += 1
		i -= 1
	return cnt
t = 1
for _ in range(t):
	b()


p = [int(_) for _ in input().split()]
(rows, columns) = (p[0], p[1])
print(*p[2:])
for i in range(columns):
	if i + 1 != p[3]:
		print(p[2], i + 1)
typ = 0
for i in range(p[2] - 1):
	for j in range(columns):
		if typ == 0:
			print(i + 1, columns - j)
		else:
			print(i + 1, j + 1)
	if typ == 0:
		typ = 1
	else:
		typ = 0
for i in range(p[2], rows):
	for j in range(columns):
		if typ == 0:
			print(i + 1, columns - j)
		else:
			print(i + 1, j + 1)
	if typ == 0:
		typ = 1
	else:
		typ = 0


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log2, ceil
from collections import defaultdict
from bisect import bisect_left as bl, bisect_right as br
from collections import Counter
from collections import deque
from heapq import heappush, heappop, heapify
mod = int(1000000000.0) + 7
ip = lambda : int(stdin.readline())
inp = lambda : map(int, stdin.readline().split())
ips = lambda : stdin.readline().rstrip()
t = 1
for _ in range(t):
	(n, m, x, y) = inp()
	ans = []
	dic = defaultdict(bool)
	ans.append([x, y])
	dic[x, y] = True
	for i in range(x - 1, 0, -1):
		ans.append([i, y])
		dic[i, y] = True
	for i in range(1, n + 1):
		if not dic[i, y]:
			ans.append([i, y])
	x = n
	ct = 1
	while ct != m:
		y = y + 1
		if y == m + 1:
			y = 1
		if x == n:
			for i in range(n, 0, -1):
				ans.append([i, y])
			x = 1
		else:
			for i in range(1, n + 1):
				ans.append([i, y])
			x = n
		ct += 1
	for i in ans:
		print(*i)


(n, m, p, q) = map(int, input().split())
d = dict()
a = [[p, q]]
a.append([1, q])
a.append([1, 1])
for i in range(1, n + 1):
	if i % 2 != 0:
		j = 1
		while j <= m:
			if i == 1 and j == 1:
				pass
			elif i == 1 and j == q:
				pass
			elif i == p and j == q:
				pass
			else:
				a.append([i, j])
			j += 1
	else:
		j = m
		while j >= 1:
			if i == 1 and j == 1:
				pass
			elif i == 1 and j == q:
				pass
			elif i == p and j == q:
				pass
			else:
				a.append([i, j])
			j += -1
for j in a:
	print(*j)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

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 Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
from math import gcd
Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()
(n, m, a, b) = Ri()
ans = []
(sa, sb) = (a, b)
while sb >= 1:
	ans.append((sa, sb))
	sb -= 1
(sa, sb) = (a, b + 1)
while sb <= m:
	ans.append((sa, sb))
	sb += 1
(sa, sb) = (a - 1, m)
flag = True
for i in range(a - 1, 0, -1):
	if flag:
		sb = m
		while sb > 0:
			ans.append((i, sb))
			sb -= 1
	else:
		sb = 1
		while sb <= m:
			ans.append((i, sb))
			sb += 1
	flag = not flag
if sb <= 0:
	sb = 1
else:
	sb = m
if sb == 1:
	flag = False
else:
	flag = True
for i in range(a + 1, n + 1):
	if flag:
		sb = m
		while sb > 0:
			ans.append((i, sb))
			sb -= 1
	else:
		sb = 1
		while sb <= m:
			ans.append((i, sb))
			sb += 1
	flag = not flag
for i in ans:
	print(*i)


import sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
(x, y, a, b) = I()
a -= 1
b -= 1
print(a + 1, b + 1)
for i in range(y):
	if i != b:
		print(a + 1, i + 1)
r = 1
flag = 0
while r <= x:
	if flag == 0:
		if r % 2:
			for i in range(y, 0, -1):
				print(r, i)
		else:
			for i in range(y):
				print(r, i + 1)
		r += 1
	else:
		if r % 2 == 0:
			for i in range(y, 0, -1):
				print(r, i)
		else:
			for i in range(y):
				print(r, i + 1)
		r += 1
	if r == a + 1:
		r += 1
		flag = 1


(n, m, x1, y1) = map(int, input().split())
for i in range(x1, n + 1):
	for j in range(y1, m + 1):
		print(i, j)
	for j in range(1, y1):
		print(i, j)
	y1 = j
for i in range(1, x1):
	for j in range(y1, m + 1):
		print(i, j)
	for j in range(1, y1):
		print(i, j)
	y1 = j


l = list(map(int, input().split()))
n = l[0]
m = l[1]
x = l[2]
y = l[3]
for i in range(y, m + 1):
	print(x, i)
for i in range(y - 1, 0, -1):
	print(x, i)
p = 1
for i in range(x + 1, n + 1):
	if p % 2 != 0:
		for j in range(1, m + 1):
			print(x + p, j)
		p += 1
	else:
		for j in range(m, 0, -1):
			print(x + p, j)
		p += 1
if (n - x) % 2 == 0:
	q = 1
	for i in range(1, x):
		if q % 2 != 0:
			for j in range(1, m + 1):
				print(q, j)
			q += 1
		else:
			for j in range(m, 0, -1):
				print(q, j)
			q += 1
else:
	q = 1
	for i in range(1, x):
		if q % 2 != 0:
			for j in range(m, 0, -1):
				print(q, j)
			q += 1
		else:
			for j in range(1, m + 1):
				print(q, j)
			q += 1


(n, m, x, y) = map(int, input().split())
(t1, t2) = (x, y)
while t2 >= 1:
	print(t1, t2)
	t2 -= 1
(t1, t2) = (x, y + 1)
while t2 <= m:
	print(t1, t2)
	t2 += 1
t2 -= 1
t1 -= 1
(j2, k) = (x - 1, 0)
while j2 >= 1:
	while t2 >= 1:
		print(t1, t2)
		t2 -= 1
	t2 += 1
	j2 -= 1
	t1 -= 1
	if j2 == 0:
		break
	while t2 <= m:
		print(t1, t2)
		t2 += 1
	t2 -= 1
	t1 -= 1
	j2 -= 1
(j2, t1) = (x + 1, x + 1)
if t2 == m:
	while j2 <= n:
		while t2 >= 1:
			print(t1, t2)
			t2 -= 1
		t2 += 1
		j2 += 1
		t1 += 1
		if j2 == n + 1:
			break
		while t2 <= m:
			print(t1, t2)
			t2 += 1
		t2 -= 1
		j2 += 1
		t1 += 1
else:
	while j2 <= n:
		while t2 <= m:
			print(t1, t2)
			t2 += 1
		t2 -= 1
		j2 += 1
		t1 += 1
		if j2 == n + 1:
			break
		while t2 >= 1:
			print(t1, t2)
			t2 -= 1
		t2 += 1
		j2 += 1
		t1 += 1


import sys
input = sys.stdin.readline
(n, m, x, y) = map(int, input().split())
ans = [(x, y), (1, y)]
for i in range(1, n + 1):
	for j in range(1, m + 1):
		if i % 2 == 1 and (not ((i, j) == (x, y) or (i, j) == (1, y))):
			ans.append((i, j))
		elif i % 2 == 0 and (not (i, m - j + 1) == (x, y)):
			ans.append((i, m - j + 1))
for (x, y) in ans:
	print(x, y)


(n, m, x, y) = map(int, input().split())
x -= 1
y -= 1
ans = []
ans.append([x, y])
now = 0
for i in list(range(x, -1, -1)) + list(range(x + 1, n)):
	now = 1 - now
	if i == x:
		ans += [[i, j] for j in range(m) if j != y]
	elif now:
		ans += [[i, j] for j in range(m)]
	else:
		ans += [[i, j] for j in range(m)][::-1]
for i in ans:
	print(i[0] + 1, i[1] + 1)


t = 1
for _ in range(t):
	(n, m, sx, sy) = list(map(int, input().rstrip().split()))
	print(sx, sy)
	for j in range(1, m + 1):
		if sy == j:
			continue
		print(sx, j)
	s = 1
	for j in range(1, n + 1):
		if j == sx:
			continue
		if s == 0:
			for i in range(1, m + 1):
				print(j, i)
		else:
			for i in range(m, 0, -1):
				print(j, i)
		if s == 0:
			s = 1
		else:
			s = 0


(n, m, x, y) = map(int, input().split())
x -= 1
y -= 1
chess = [[False for i in range(m)] for j in range(n)]
chess[x][y] = True
print('{0} {1}'.format(x + 1, y + 1))
chess[x][0] = True
print('{0} {1}'.format(x + 1, 1))
x = 0
y = 0
for i in range(m):
	evenColumn = 0
	oddColumn = n - 1
	if i % 2 == 0:
		j = evenColumn
		while j < n:
			if chess[j][i] == False:
				print('{0} {1}'.format(j + 1, i + 1))
				chess[j][i] = True
			j += 1
	else:
		j = oddColumn
		while j >= 0:
			if chess[j][i] == False:
				print('{0} {1}'.format(j + 1, i + 1))
				chess[j][i] = True
			j -= 1


(n, m, x, y) = map(int, input().split())
visited = [[False for i in range(m + 1)] for j in range(n + 1)]
visited[x][y] = True
print(x, y)
print(1, y)
visited[1][y] = True
for row in range(1, n + 1):
	if row % 2 == 1:
		for col in range(1, m + 1):
			if visited[row][col] is False:
				print(row, col)
	else:
		for col in range(m, 0, -1):
			if visited[row][col] is False:
				print(row, col)


(m, n, x, y) = map(int, input().split())
flag = True
temp_x = x
temp_y = y
while temp_y > 0:
	print(temp_x, temp_y)
	if flag:
		temp_y += 1
	else:
		temp_y -= 1
	if temp_y > n:
		flag = False
		temp_y = y - 1
temp_x = x + 1
temp_y = 1
flag = True
while temp_x <= m:
	print(temp_x, temp_y)
	if flag:
		temp_y += 1
	else:
		temp_y -= 1
	if temp_y > n:
		temp_x += 1
		temp_y -= 1
		flag = False
	elif temp_y < 1:
		temp_x += 1
		temp_y += 1
		flag = True
temp_x = x - 1
while temp_x > 0:
	print(temp_x, temp_y)
	if flag:
		temp_y += 1
	else:
		temp_y -= 1
	if temp_y > n:
		temp_x -= 1
		temp_y -= 1
		flag = False
	elif temp_y < 1:
		temp_x -= 1
		temp_y += 1
		flag = True


(n, m, s, t) = (int(i) for i in input().split())
print(s, t)
for i in range(t + 1, m + 1):
	print(s, i)
for i in range(t - 1, 0, -1):
	print(s, i)
numbers = list(range(1, m + 1))
z = 1
for k in range(s - 1, 0, -1):
	if z:
		for i in numbers:
			print(k, i)
	else:
		for i in numbers[::-1]:
			print(k, i)
	z = 1 - z
for k in range(s + 1, n + 1):
	if z:
		for i in numbers:
			print(k, i)
	else:
		for i in numbers[::-1]:
			print(k, i)
	z = 1 - z


(n, m, X, Y) = map(int, input().split())
result = []
result.append((X, Y))
for i in range(X - 1, 0, -1):
	result.append((i, Y))
for i in range(X + 1, n + 1):
	result.append((i, Y))
direct = -1
last_pos_x = n
end_pos_x = 1
for y in range(Y - 1, 0, -1):
	for x in range(last_pos_x, end_pos_x + direct, direct):
		result.append((x, y))
	(last_pos_x, end_pos_x) = (end_pos_x, last_pos_x)
	direct = -direct
for y in range(Y + 1, m + 1):
	for x in range(last_pos_x, end_pos_x + direct, direct):
		result.append((x, y))
	(last_pos_x, end_pos_x) = (end_pos_x, last_pos_x)
	direct = -direct
for r in result:
	print(r[0], r[1])


(m, n, sx, sy) = map(int, input().split())
sx -= 1
sy -= 1
vis = []
for i in range(m):
	h = []
	for j in range(n):
		h.append(False)
	vis.append(h)
for i in range(sx, m):
	print(i + 1, sy + 1)
	vis[i][sy] = True
for i in range(sx - 1, -1, -1):
	print(i + 1, sy + 1)
	vis[i][sy] = True
turn = 0
for j in range(0, n):
	if vis[turn][j] == False:
		print(turn + 1, j + 1)
		vis[turn][j] = True
		for i in range(m - 1, turn, -1):
			print(i + 1, j + 1)
			vis[i][j] = True
		for i in range(turn - 1, -1, -1):
			print(i + 1, j + 1)
			vis[i][j] = True
		turn = (turn + 1) % 2


(n, m, x, y) = map(int, input().split())
for xd in range(n):
	x1 = x + xd
	if x1 % n == 0:
		x1 = n
	else:
		x1 %= n
	for jd in range(m):
		y1 = y + jd
		if y1 % m == 0:
			if x1 % n == 0:
				print(n, m)
			else:
				print(x1 % n, m)
		elif x1 % n == 0:
			print(n, y1 % m)
		else:
			print(x1 % n, y1 % m)
	y = y1


(n, m, r, s) = map(int, input().split())
s1 = [r, s]
print(r, s)
if r != 1:
	a = 1
	b = s
	print(1, s)
if r != 1 and s != 1:
	c = 1
	d = 1
	print(1, 1)
i = j = 1
for i in range(1, n + 1):
	if i % 2 != 0:
		for j in range(1, m + 1):
			if i == r and j == s:
				continue
			if i == 1 and j == 1:
				continue
			elif i == a and j == b:
				continue
			elif i == c and j == d:
				continue
			else:
				print(i, j)
	else:
		for j in range(m, 0, -1):
			if i == r and j == s:
				continue
			if i == 1 and j == 1:
				continue
			elif i == a and j == b:
				continue
			elif i == c and j == d:
				continue
			else:
				print(i, j)


(n, m, sx, sy) = list(map(int, input().split()))
sx -= 1
sy -= 1
seq = []
v = [[0 for _ in range(m)] for _ in range(n)]
seq.append([sx, sy])
v[sx][sy] = 1
if sy != 0:
	seq.append([sx, 0])
	v[sx][0] = 1
for i in range(1, m):
	if v[sx][i] == 0:
		seq.append([sx, i])
		v[sx][i] = 1
for i in range(sx - 1, -1, -1):
	if (i - (sx - 1)) % 2 != 0:
		for j in range(m):
			if v[i][j] == 0:
				seq.append([i, j])
				v[i][j] = 1
	else:
		for j in range(m - 1, -1, -1):
			if v[i][j] == 0:
				seq.append([i, j])
				v[i][j] = 1
if seq[-1][1] + 1 == m:
	for i in range(sx + 1, n):
		if (i - (sx + 1)) % 2 != 0:
			for j in range(m):
				if v[i][j] == 0:
					seq.append([i, j])
					v[i][j] = 1
		else:
			for j in range(m - 1, -1, -1):
				if v[i][j] == 0:
					seq.append([i, j])
					v[i][j] = 1
else:
	for i in range(sx + 1, n):
		if (i - (sx + 1)) % 2 == 0:
			for j in range(m):
				if v[i][j] == 0:
					seq.append([i, j])
					v[i][j] = 1
		else:
			for j in range(m - 1, -1, -1):
				if v[i][j] == 0:
					seq.append([i, j])
					v[i][j] = 1
for i in seq:
	print(i[0] + 1, i[1] + 1)


import math
import collections
from sys import stdin, stdout, setrecursionlimit
from bisect import bisect_left as bsl
from bisect import bisect_right as bsr
import heapq as hq
setrecursionlimit(2 ** 20)
t = 1
for _ in range(t):
	(n, m, x, y) = list(map(int, stdin.readline().rstrip().split()))
	print(x, y)
	for j in range(1, m + 1):
		if y == j:
			continue
		print(x, j)
	l = []
	st = 1
	for i in range(1, n + 1):
		if i == x:
			continue
		if st == 0:
			for j in range(1, m + 1):
				print(i, j)
		else:
			for j in range(m, 0, -1):
				print(i, j)
		st = 1 if st == 0 else 0


(a, b, c, d) = map(int, input().split())
print(c, d)
if c != 1:
	f = 0
	print(1, d)
	if d != 1:
		print(1, 1)
elif d != 1:
	f = 1
	print(c, 1)
	if c != 1:
		print(1, 1)
for i in range(1, a + 1):
	if i % 2 == 0:
		for j in range(b, 0, -1):
			x = i
			y = j
			if f == 0:
				if x == 1 and y == 1:
					pass
				elif x == 1 and y == d:
					pass
				elif x == c and y == d:
					pass
				else:
					print(x, y)
			if f == 1:
				if x == 1 and y == 1:
					pass
				elif x == c and y == 1:
					pass
				elif x == c and y == d:
					pass
				else:
					print(x, y)
	else:
		for j in range(1, b + 1):
			x = i
			y = j
			if f == 0:
				if x == 1 and y == 1:
					pass
				elif x == 1 and y == d:
					pass
				elif x == c and y == d:
					pass
				else:
					print(x, y)
			if f == 1:
				if x == 1 and y == 1:
					pass
				elif x == c and y == 1:
					pass
				elif x == c and y == d:
					pass
				else:
					print(x, y)


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

def Print(i, j):
	print((i + Sx - 2) % n + 1, (j + Sy - 2) % m + 1)

def solve(n, m, Sxy, Sy):
	for i in range(1, n + 1):
		if i & 1:
			for j in range(1, m + 1):
				Print(i, j)
		else:
			for j in range(m, 0, -1):
				Print(i, j)
solve(n, m, Sx, Sy)


import collections

def fun():
	(n, m, x, y) = [int(x) for x in input().split()]
	p = []
	i = x
	for j in range(y, m + 1):
		p.append([i, j])
	for j in range(y - 1, 0, -1):
		p.append([i, j])
	turn = 0
	i = 1
	while len(p) != n * m:
		if i == x:
			i += 1
			continue
		if turn == 0:
			for j in range(1, m + 1):
				p.append([i, j])
		else:
			for j in range(m, 0, -1):
				p.append([i, j])
		i += 1
		if i > n:
			break
		turn = 1 - turn
	for x in p:
		print(str(x[0]) + ' ' + str(x[1]))
fun()


import sys
input = sys.stdin.readline
for _ in range(1):
	(n, m, x, y) = map(int, input().split())
	ans = [[x, y]]
	for j in range(y - 1, 0, -1):
		ans.append([x, j])
	for j in range(y + 1, m + 1):
		ans.append([x, j])
	left_print = False
	end_left = False
	if (n - x) % 2:
		end_left = True
	for i in range(x + 1, n + 1):
		if left_print:
			for j in range(1, m + 1):
				ans.append([i, j])
			left_print = False
		else:
			for j in range(m, 0, -1):
				ans.append([i, j])
			left_print = True
	for i in range(x - 1, 0, -1):
		if end_left:
			for j in range(1, m + 1):
				ans.append([i, j])
			end_left = False
		else:
			for j in range(m, 0, -1):
				ans.append([i, j])
			end_left = True
	for i in ans:
		print(*i)


import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
ALPHA = 'abcdefghijklmnopqrstuvwxyz'
M = 10 ** 9 + 7
EPS = 1e-06

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
(n, m, x, y) = value()
vis = [[False for i in range(m + 1)] for j in range(n + 1)]
print(x, y)
vis[x][y] = True
if x != 1 or y != 1:
	if y > 2:
		print(x, 2)
		vis[x][2] = True
	if x > 1:
		print(1, 2)
		vis[1][2] = True
	print(1, 1)
	vis[1][1] = True
x = 1
y = 1
for i in range(n):
	if i % 2 == 0:
		for i in range(2, m + 1):
			if not vis[x][i]:
				print(x, i)
		y = m
	else:
		for i in range(m - 1, 0, -1):
			if not vis[x][i]:
				print(x, i)
		y = 1
	if x < n:
		print(x + 1, y)
	x += 1


import os
import re
import sys
from bisect import bisect, bisect_left, insort, insort_left
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from io import BytesIO, IOBase
from itertools import accumulate, combinations, combinations_with_replacement, groupby, permutations, product
from math import acos, asin, atan, ceil, cos, degrees, factorial, hypot, log2, pi, radians, sin, sqrt, tan
from operator import itemgetter, mul
from string import ascii_lowercase, ascii_uppercase, digits

def inp():
	return int(input())

def inlist():
	return list(map(int, input().split()))

def instr():
	s = input()
	return list(s[:len(s)])

def invr():
	return map(int, input().split())

def visitRow(r, c, n, m):
	y = c
	print(r, c)
	for i in range(1, m + 1):
		if i == c:
			continue
		y = i
		print(r, i)
	return (r, y)

def main():
	(n, m, x, y) = invr()
	tx = x
	for i in range(x, n + 1):
		(tx, y) = visitRow(i, y, n, m)
	for i in range(1, x):
		(tx, y) = visitRow(i, y, n, m)
main()


def solve():
	(n, m, x, y) = map(int, input().split())
	for i in range(y, 0, -1):
		print(x, i)
	for i in range(y + 1, m + 1):
		print(x, i)
	y = m
	left = True
	for i in range(x - 1, 0, -1):
		if left:
			for j in range(y, 0, -1):
				print(i, j)
			left = False
			y = 1
		else:
			for j in range(y, m + 1):
				print(i, j)
			left = True
			y = m
	for i in range(x + 1, n + 1):
		if left:
			for j in range(y, 0, -1):
				print(i, j)
			left = False
			y = 1
		else:
			for j in range(y, m + 1):
				print(i, j)
			left = True
			y = m
solve()


(r, c, xi, yi) = list(map(int, input().split()))
print(xi, yi)
for m in range(1, yi):
	print(xi, m)
for n in range(yi + 1, c + 1):
	print(xi, n)
y = c
for i in range(1, xi):
	if y == c:
		for j in range(c, 0, -1):
			print(i, j)
		y = 1
		continue
	if y == 1:
		for j in range(1, c + 1):
			print(i, j)
		y = c
for p in range(xi + 1, r + 1):
	if y == c:
		for q in range(c, 0, -1):
			print(p, q)
		y = 1
		continue
	if y == 1:
		for q in range(1, c + 1):
			print(p, q)
		y = c