Riley is a very bad boy, but at the same time, he is a yo-yo master. So, he decided to use his yo-yo skills to annoy his friend Anton.

Anton's room can be represented as a grid with $n$ rows and $m$ columns. Let $(i, j)$ denote the cell in row $i$ and column $j$. Anton is currently standing at position $(i, j)$ in his room. To annoy Anton, Riley decided to throw exactly two yo-yos in cells of the room (they can be in the same cell).

Because Anton doesn't like yo-yos thrown on the floor, he has to pick up both of them and return back to the initial position. The distance travelled by Anton is the shortest path that goes through the positions of both yo-yos and returns back to $(i, j)$ by travelling only to adjacent by side cells. That is, if he is in cell $(x, y)$ then he can travel to the cells $(x + 1, y)$, $(x - 1, y)$, $(x, y + 1)$ and $(x, y - 1)$ in one step (if a cell with those coordinates exists).

Riley is wondering where he should throw these two yo-yos so that the distance travelled by Anton is maximized. But because he is very busy, he asked you to tell him.


-----Input-----

The first line contains a single integer $t$ ($1 \leq t \leq 10^4$) — the number of test cases. Then $t$ test cases follow.

The only line of each test case contains four integers $n$, $m$, $i$, $j$ ($1 \leq n, m \leq 10^9$, $1\le i\le n$, $1\le j\le m$) — the dimensions of the room, and the cell at which Anton is currently standing.


-----Output-----

For each test case, print four integers $x_1$, $y_1$, $x_2$, $y_2$ ($1 \leq x_1, x_2 \leq n$, $1\le y_1, y_2\le m$) — the coordinates of where the two yo-yos should be thrown. They will be thrown at coordinates $(x_1,y_1)$ and $(x_2,y_2)$.

If there are multiple answers, you may print any.


-----Examples-----

Input
7
2 3 1 1
4 4 1 2
3 5 2 2
5 1 2 1
3 1 3 1
1 1 1 1
1000000000 1000000000 1000000000 50
Output
1 2 2 3
4 1 4 4
3 1 1 5
5 1 1 1
1 1 2 1
1 1 1 1
50 1 1 1000000000


-----Note-----

Here is a visualization of the first test case.

Difficulty: EASY
Tags: Greedy algorithms

Mathematics

Constructive algorithms
Skill types: Greedy algorithms

Starter code:

Solutions:
import sys
inputs = []
for line in sys.stdin:
	inputs.append(line)
numCases = int(inputs[0].strip())
for l in range(1, numCases + 1):
	case = inputs[l].strip().split()
	n = int(case[0])
	m = int(case[1])
	print(f'1 1 {n} {m}')


for i in [*open(0)][1:]:
	print(*i.split()[:2], 1, 1)


for s in [*open(0)][1:]:
	print('1 1', *s.split()[:2])


import sys
t = int(sys.stdin.readline())
for x in range(t):
	(n, m, i, j) = map(int, sys.stdin.readline().split())
	print(f'1 1 {n} {m}')


ans = []
for _ in range(int(input())):
	(n, m, a, b) = map(int, input().split())
	if a == b == 1 or (a == n and b == m):
		(w, x, y, z) = (n, 1, 1, m)
	elif a == 1 and b == m or (a == n and b == 1):
		(w, x, y, z) = (1, 1, n, m)
	else:
		(w, x, y, z) = (1, 1, n, m)
	ans.append(str(w) + ' ' + str(x) + ' ' + str(y) + ' ' + str(z))
print('\n'.join(ans))


t = int(input())
i = 0
A = []
while 0 <= i < t:
	i = i + 1
	(m, n, a, b) = map(int, input().split())
	l = str(m) + ' ' + str(1) + ' ' + str(1) + ' ' + str(n)
	A.append(l)
k = -1
while -1 <= k < t - 1:
	k = k + 1
	print(A[k])


import sys, random, bisect
from collections import deque, defaultdict
from heapq import heapify, heappop, heappush
from itertools import permutations
from math import gcd, log, comb, perm, factorial
mod = int(1000000000.0 + 7)
inf = int(1e+20)
input = lambda : sys.stdin.readline().rstrip()
mi = lambda : map(int, input().split())
li = lambda : list(mi())
ii = lambda : int(input())
t = ii()
for _ in range(t):
	(n, m, i, j) = li()
	print(f'{1} {1} {n} {m}')


cases = int(input())
grid_list = []
for case in range(cases):
	grid_list.append(list((int(x) for x in input().split())))
for grid in grid_list:
	print('1 ' + '1 ' + str(grid[0]) + ' ' + str(grid[1]))


for s in [*open(0)][1:]:
	(n, m, i, j) = map(int, s.split())
	print(1, 1, n, m)


from sys import stdin
input = stdin.readline
from itertools import accumulate

def solve():
	(n, m, x, y) = [int(char) for char in input().split()]
	return [1, 1, n, m]
for _ in range(int(input())):
	print(*solve())


import sys
input = sys.stdin.readline

def solve():
	(n, m, i, j) = map(int, input().split())
	return [1, 1, n, m]
for _ in range(int(input())):
	print(*solve())


t = int(input())
l1 = []
l2 = []
l3 = []
l4 = []
for k in range(t):
	(n, m, i, j) = map(int, input().split())
	l1.append(n)
	l2.append(m)
	l3.append(i)
	l4.append(j)
for i in range(len(l1)):
	print(1, 1, l1[i], l2[i])


from sys import stdin

def A():
	t = stdin.readline()
	t = int(t)
	while t:
		k = stdin.readline()
		n = [int(x) for x in stdin.readline().split()]
		res = 0
		for i in n:
			res += i
		k = len(n)
		if res % k == 0 and res / k == 1:
			print(0)
		elif res < 0:
			print(1)
		elif res % k != 0:
			print(res % k)
		else:
			print(res - res // k + 1)
		t -= 1

def B():
	t = stdin.readline()
	t = int(t)
	while t:
		t -= 1
		a = [int(x) for x in stdin.readline().split()]
		(n, m, i, j) = (a[0], a[1], a[2], a[3])
		(x1, y1, x2, y2) = (1, 1, n, m)
		print(x1, y1, x2, y2)
B()


import sys
input = lambda : sys.stdin.readline()
int_arr = lambda : list(map(int, input().split()))
str_arr = lambda : list(map(str, input().split()))
get_str = lambda : map(str, input().split())
get_int = lambda : map(int, input().split())
get_flo = lambda : map(float, input().split())
mod = 1000000007

def solve():
	pass
for _ in range(int(input())):
	(x, y, i, j) = get_int()
	print(1, 1, x, y)


def is_first_case(n, m, i, j):
	if i < n / 2:
		if j < m / 2:
			return 1
		else:
			return 0
	elif j < m / 2:
		return 0
	else:
		return 1

def define_positions(n, m, i, j):
	if is_first_case(n, m, i, j):
		return (1, m, n, 1)
	else:
		return (n, 1, 1, m)
result = []
quantity_tests = int(input())
for test in range(quantity_tests):
	args = list(map(int, input().split()))
	result.append(' '.join(map(str, define_positions(*args))))
print('\n'.join(result))


for i in [*open(0)][1:]:
	(a, b, *_) = i.split()
	print(a, b, 1, 1)


l = []
t = int(input())
for ti in range(t):
	x = [int(x) for x in input().split()]
	l.append([x[0], x[1]])
for j in range(t):
	print('1 1', l[j][0], l[j][1])


def badboy(n, m, i, j):
	if i >= n // 2 and j >= m // 2 or (i < n // 2 and j < m // 2):
		return str(n) + ' 1' + ' 1 ' + str(m)
	elif i >= n // 2 and j < m // 2 or (i < n // 2 and j >= m // 2):
		return '1 1 ' + str(n) + ' ' + str(m)
arr = []
for i in range(int(input())):
	a = input().split()
	arr.append(badboy(int(a[0]), int(a[1]), int(a[2]), int(a[3])))
for i in arr:
	print(i)


IP = lambda : list(map(int, input().split()))
for i in [*open(0)][1:]:
	print(*i.split()[:2], 1, 1)


t = int(input())
a = []
for _ in range(t):
	(rs, cs, r, c) = [int(x) for x in input().split()]
	co = [[1, 1], [1, cs], [rs, cs], [rs, 1]]
	d = [r + c - 2, r - 1 + cs - c, rs - r + cs - c, rs - r + c - 1]
	idx = -1
	mx = 0
	for i in range(4):
		x = d[i]
		if x > mx:
			mx = x
			idx = i
	a.append(' '.join(map(str, co[idx] + co[(idx + 2) % 4])))
print('\n'.join(a))


for _ in range(int(input())):
	(n, m, x, y) = map(int, input().split())
	print(f'1 1 {n} {m}')


howMany = int(input())
e = []
for i in range(howMany):
	(a, b, c, d) = input().split(' ')
	e.append((int(a), int(b), 1, 1))
for i in e:
	for j in i:
		print(f'{j} ', end='')
	print()


n = int(input())
ans = []
for i in range(n):
	(n, m, i, j) = input().split()
	(n, m, i, j) = (int(n), int(m), int(i), int(j))
	if i == 1 and j == 1 or (i == n and j == m):
		k = [1, m, n, 1]
		ans.append(k)
	else:
		k = [1, 1, n, m]
		ans.append(k)
for i in range(len(ans)):
	for ele in ans[i]:
		print(ele, end=' ')
	print(end='\n')


for run in range(int(input())):
	(n, m, i, j) = map(int, input().split())
	print(f'1 1 {n} {m}')


testcases = int(input())
results = []

def dist_traveled(poss, i, j):
	return abs(poss[0] - i) + abs(poss[1] - j) + abs(poss[2] - i) + abs(poss[2] - j)
for i in range(testcases):
	[n, m, i, j] = [int(num) for num in input().split()]
	poss1 = [1, 1, n, m]
	poss2 = [n, 1, 1, m]
	results.append(poss1 if dist_traveled(poss1, i, j) > dist_traveled(poss2, i, j) else poss2)
for i in results:
	print(' '.join([str(num) for num in i]))


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(n, m, i, j) = map(int, input().split())
	print(1, 1, n, m)


import sys
input = sys.stdin.readline
T = int(input())
for _ in range(T):
	(n, m, i, j) = map(int, input().split())
	x = y = 0
	x = n if i <= n // 2 else 1
	y = m if j <= m // 2 else 1
	print(x, y, n - x + 1, m - y + 1)


for s in [*open(0)][1:]:
	(n, m, *_) = map(int, s.split())
	print(1, 1, n, m)


def process(n, m, i, j):
	return (1, m, n, 1)
t = int(input())
ans = []
for _ in range(t):
	(n, m, i, j) = [int(i) for i in input().split(' ')]
	ans.append(process(n, m, i, j))
for i in ans:
	print(' '.join((str(j) for j in i)))


import math
import sys
input = sys.stdin.readline

def solve():
	x = [int(_) for _ in input().split()]
	print(1, 1, x[0], x[1])
tt = int(input())
for test in range(tt):
	solve()


t = int(input())
for case in range(t):
	(n, m, i, j) = map(int, input().split())
	print('1 1 {} {}'.format(n, m))


t = int(input())
while t > 0:
	x = list(map(int, input().split(' ')))
	row = x[0]
	col = x[1]
	i = x[2]
	j = x[3]
	s = '1 1 ' + str(row) + ' ' + str(col)
	print(s)
	t -= 1


t = int(input())
arr = []
for a in range(t):
	(n, m, i, j) = tuple([int(x) for x in input().split()])
	(x1, y1, x2, y2) = (0, 0, 0, 0)
	if i > n / 2 and j > m / 2 or (i < n / 2 and j < m / 2):
		x1 = n
		x2 = 1
		y1 = 1
		y2 = m
	else:
		x1 = n
		x2 = 1
		y1 = m
		y2 = 1
	arr.append('{} {} {} {}'.format(x1, y1, x2, y2))
for element in arr:
	print(element)


num_test_cases = int(input())
results = []
for c in range(num_test_cases):
	line = input()
	(n, m, i, j) = line.split(sep=' ')
	results.append([1, 1, n, m])
for l in results:
	print(*l, sep=' ')


import sys

def main():
	pass

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

def decimal(s):
	return int(s, 2)

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def lts(l):
	s = ''.join(map(str, l))
	return s
1000000007

def func1(s1, s2):
	for i in range(len(s1)):
		if s[i] < s2[i]:
			return s1
		elif s[i] > s2[i]:
			return s2
	return s1

def func2(s, m):
	st = ''
	for i in range(m):
		st += s[i % len(s)]
	return st
mod = int(1000000000.0) + 7

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

def zinp():
	return int(input())

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

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

def p(xyz):
	print(xyz)

def p2(a, b):
	print(a, b)
for _ in range(zinp()):
	(n, m, i, j) = zzinp()
	if i <= n // 2 and j <= m // 2:
		print(1, m, n, 1)
	elif i >= n // 2 and j >= m // 2:
		print(1, m, n, 1)
	else:
		print(1, 1, n, m)


for iters in range(int(input())):
	a = input()
	(n, m, i, j) = a.split(' ')
	print(n + ' 1 1 ' + m)


for _ in range(int(input())):
	x = input()
	(n, m, i, j) = x.split(' ')
	print('1 1 ' + n + ' ' + m)


import sys
from math import ceil, floor
from collections import deque

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

def get_array():
	return list(get_ints())

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

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
T = int(input())
while T > 0:
	(n, m, i, j) = get_ints()
	print(1, 1, n, m)
	T -= 1


t = int(input())
input_list = []
while t > 0:
	(n, m, i, j) = [int(x) for x in input().split()]
	input_list.append([n, m, i, j])
	t -= 1

def max_distance(length, sit):
	if abs(length - sit) > sit:
		position = length
		sec_position = 1
	else:
		position = 1
		sec_position = length
	return (position, sec_position)
for item in input_list:
	(x1, x2) = max_distance(item[0], item[2])
	(y1, y2) = max_distance(item[1], item[3])
	print(x1, y1, x2, y2)


for _ in range(int(input())):
	(n, m, i, j) = map(str, input().split())
	if int(m) == 1 or int(n) == 1:
		line = '1 1 ' + n + ' ' + m
	elif i == 1:
		line = n + ' 1 ' + n + ' ' + m
	elif i == n:
		line = '1 1 1 ' + m
	else:
		line = '1 1 ' + n + ' ' + m
	print(line)


for _ in range(int(input())):
	n = input().split()
	print(f'1 1 {n[0]} {n[1]}')


for _ in range(int(input())):
	(n, m, i, j) = map(int, input().split())
	print('%d %d %d %d' % (1, 1, n, m))


for i in range(int(input())):
	a = list(map(str, input().split(' ')))
	print(' '.join(a[0:2]) + ' 1' + ' 1')


import math

def main():
	t = int(input())
	for _ in range(t):
		print(case())

def case():
	(n, m, i, j) = map(int, input().split())
	if m - j > j - 1:
		y1 = m
	else:
		y1 = 1
	if n - i > i - 1:
		x1 = n
	else:
		x1 = 1
	if x1 == 1:
		x2 = n
	else:
		x2 = 1
	if y1 == 1:
		y2 = m
	else:
		y2 = 1
	return ' '.join(list(map(str, [x1, y1, x2, y2])))
main()


num = int(input())
for i in range(num):
	arr = input().split(' ')
	print(arr[0], arr[1], 1, 1)


import math
import sys
import itertools
import fractions
wtf = sys.stdin.read()
wtf = wtf.strip().split('\n')
GAP = 1
for t in [wtf[i:i + GAP] for i in range(1, len(wtf), GAP)]:
	(n, m, i, j) = map(int, t[0].split())
	ans = []
	ans.append(abs(1 - i) + abs(1 - j) + abs(n - i) + abs(m - j))
	ans.append(abs(1 - i) + abs(m - j) + abs(n - i) + abs(1 - j))
	tmp = [(1, 1, n, m), (1, m, n, 1)]
	ans = sorted(range(len(ans)), key=lambda k: ans[k], reverse=True)
	print(' '.join(map(str, tmp[ans[0]])))


for i in range(int(input())):
	(n, m, x, y) = list(map(int, input().split()))
	print('1 1 ' + str(n) + ' ' + str(m))


t = int(input())
for oasdfj in range(t):
	array = [int(x) for x in input().split()]
	print(f'1 1 {array[0]} {array[1]}')


import sys

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

def N():
	return int(inp())

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

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

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

def fsep():
	return map(float, inp().split())

def testcase(t):
	for p in range(t):
		solve()

def solve():
	(n, m, i, j) = take()

	def f(t):
		return abs(t[0][0] - i) + abs(t[0][1] - j) + abs(t[1][0] - i) + abs(t[1][1] - j)
	firster = [[1, 1], [n, m]]
	seconder = [[1, m], [n, 1]]
	if f(firster) <= f(seconder):
		print(firster[0][0], firster[0][1], firster[1][0], firster[1][1])
	else:
		print(seconder[0][0], seconder[0][1], seconder[1][0], seconder[1][1])
testcase(N())


t = int(input())
l = []
for i in range(0, t):
	l.append(list(map(int, input().split())))
for i in range(0, t):
	if l[i][2] <= round(l[i][0] / 2):
		if l[i][3] <= round(l[i][1] / 2):
			print(l[i][0], 1, 1, l[i][1])
		else:
			print(1, 1, l[i][0], l[i][1])
	elif l[i][3] <= round(l[i][1] / 2):
		print(1, 1, l[i][0], l[i][1])
	else:
		print(l[i][0], 1, 1, l[i][1])


t = int(input())
answers = []
for _ in range(t):
	(n, m, i, j) = map(int, input().split(' '))
	if n == 1:
		answers.append((1, 1, 1, m))
	else:
		top_right_dist = i - 0 + (m - j)
		bottom_left_dist = n - i + (j - 0)
		top_left_dist = i - 0 + (j - 0)
		bottom_right_dist = n - i + (m - j)
		if top_right_dist + bottom_left_dist <= top_left_dist + bottom_right_dist:
			answers.append((1, m, n, 1))
		else:
			answers.append((1, 1, n, m))
for answer in answers:
	print(*answer)


import sys, math

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

def solution():
	for _ in range(int(input())):
		(n, m, i, j) = scan()
		x1 = 1 if i - 1 > n - i else n
		x2 = n if i - 1 > n - i else 1
		y1 = 1 if j - 1 > m - j else m
		y2 = m if j - 1 > m - j else 1
		print(x1, y1, x2, y2)
solution()


t = int(input())
for u in range(0, t):
	(n, m, i, j) = input().split()
	print('1 1 ', end='')
	print(n + ' ' + m)


def solve(n, m, i, j):
	res = '1 1 ' + str(n) + ' ' + str(m)
	print(res)
t = int(input())
for _ in range(t):
	(n, m, i, j) = map(int, input().split())
	solve(n, m, i, j)


t = int(input())
output = []
for i in range(t):
	(n, m, i, j) = list(map(int, input().split()))
	if n - i < n / 2 and m - j > m / 2 or (n - i > n / 2 and m - j < m / 2):
		output.append([n, 1, 1, m])
	else:
		output.append([1, 1, n, m])
for i in output:
	for j in i:
		print(j, end=' ')
	print()


n = int(input())
posList = []
for i in range(n):
	case = list(map(int, input().split()))
	posCase = [1, 1, case[0], case[1]]
	posList.append(posCase)
for i in range(n):
	print(posList[i][0], posList[i][1], posList[i][2], posList[i][3])


test_num = input()
result = []
for iters in range(int(test_num)):
	[n, m, i, j] = input().split()
	n = int(n)
	m = int(m)
	i = int(i)
	j = int(j)
	dot1 = [i, j]
	if n - i >= i:
		dot1[0] += n - i
	else:
		dot1[0] -= i - 1
	if m - j >= j:
		dot1[1] += m - j
	else:
		dot1[1] -= j - 1
	(i, j) = (dot1[0], dot1[1])
	dot2 = [i, j]
	if n - i >= i:
		dot2[0] += n - i
	else:
		dot2[0] -= i - 1
	if m - j >= j:
		dot2[1] += m - j
	else:
		dot2[1] -= j - 1
	dot1.extend(dot2)
	result.extend([dot1])
for elem_print in result:
	print(*elem_print)


t = int(input())
for i in range(t):
	(n, m, i, j) = input().split()
	print('1 1 ' + str(n) + ' ' + str(m))


t = int(input())
for i in range(t):
	(x1, y1, x2, y2) = map(int, input().split())
	print(1, 1, x1, y1)


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


import math
t = int(input())
while t:
	(n, m, i, j) = map(int, input().split())
	print(1, 1, n, m)
	t -= 1


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


t = int(input())
for _ in range(t):
	(n, m, i, j) = list(map(int, input().split()))
	print(1, 1, n, m)


t = int(input())
while t:
	(a, b, c, d) = map(int, input().split())
	print(1, 1, a, b)
	t -= 1


for x in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	print(1, 1, a, b)