Frodo was caught by Saruman. He tore a pouch from Frodo's neck, shook out its contents —there was a pile of different rings: gold and silver...

"How am I to tell which is the One?!" the mage howled.

"Throw them one by one into the Cracks of Doom and watch when Mordor falls!"

Somewhere in a parallel Middle-earth, when Saruman caught Frodo, he only found $n$ rings. And the $i$-th ring was either gold or silver. For convenience Saruman wrote down a binary string $s$ of $n$ characters, where the $i$-th character was 0 if the $i$-th ring was gold, and 1 if it was silver.

Saruman has a magic function $f$, which takes a binary string and returns a number obtained by converting the string into a binary number and then converting the binary number into a decimal number. For example, $f(001010) = 10, f(111) = 7, f(11011101) = 221$.

Saruman, however, thinks that the order of the rings plays some important role. He wants to find $2$ pairs of integers $(l_1, r_1), (l_2, r_2)$, such that:

$1 \le l_1 \le n$, $1 \le r_1 \le n$, $r_1-l_1+1\ge \lfloor \frac{n}{2} \rfloor$

$1 \le l_2 \le n$, $1 \le r_2 \le n$, $r_2-l_2+1\ge \lfloor \frac{n}{2} \rfloor$

Pairs $(l_1, r_1)$ and $(l_2, r_2)$ are distinct. That is, at least one of $l_1 \neq l_2$ and $r_1 \neq r_2$ must hold.

Let $t$ be the substring $s[l_1:r_1]$ of $s$, and $w$ be the substring $s[l_2:r_2]$ of $s$. Then there exists non-negative integer $k$, such that $f(t) = f(w) \cdot k$.

Here substring $s[l:r]$ denotes $s_ls_{l+1}\ldots s_{r-1}s_r$, and $\lfloor x \rfloor$ denotes rounding the number down to the nearest integer.

Help Saruman solve this problem! It is guaranteed that under the constraints of the problem at least one solution exists.


-----Input-----

Each test contains multiple test cases.

The first line contains one positive integer $t$ ($1 \le t \le 10^3$), denoting the number of test cases. Description of the test cases follows.

The first line of each test case contains one positive integer $n$ ($2 \le n \le 2 \cdot 10^4$) — length of the string.

The second line of each test case contains a non-empty binary string of length $n$.

It is guaranteed that the sum of $n$ over all test cases does not exceed $10^5$.


-----Output-----

For every test case print four integers $l_1$, $r_1$, $l_2$, $r_2$, which denote the beginning of the first substring, the end of the first substring, the beginning of the second substring, and the end of the second substring, respectively.

If there are multiple solutions, print any.


-----Examples-----

Input
7
6
101111
9
111000111
8
10000000
5
11011
6
001111
3
101
30
100000000000000100000000000000
Output
3 6 1 3
1 9 4 9
5 8 1 4
1 5 3 5
1 6 2 4
1 2 2 3
1 15 16 30


-----Note-----

In the first testcase $f(t) = f(1111) = 15$, $f(w) = f(101) = 5$.

In the second testcase $f(t) = f(111000111) = 455$, $f(w) = f(000111) = 7$.

In the third testcase $f(t) = f(0000) = 0$, $f(w) = f(1000) = 8$.

In the fourth testcase $f(t) = f(11011) = 27$, $f(w) = f(011) = 3$.

In the fifth testcase $f(t) = f(001111) = 15$, $f(w) = f(011) = 3$.

Difficulty: MEDIUM
Tags: Mathematics

Constructive algorithms

Starter code:

Solutions:
for _ in range(int(input())):
	n = int(input())
	s = input()
	if '0' in s:
		i = s.index('0')
		if i < n // 2:
			print(i + 1, n, i + 2, n)
		else:
			print(1, i + 1, 1, i)
	else:
		print(1, n // 2, n // 2 + 1, n // 2 + n // 2)


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

def main(t):
	n = int(input())
	s = input()
	for i in range(n // 2):
		if s[i] == ord('0'):
			print(i + 1, n, i + 2, n)
			return
	for i in range(n // 2, n):
		if s[i] == ord('0'):
			print(1, i + 1, 1, i)
			return
	print(1, n // 2 * 2, 1, n // 2)
T = int(input())
t = 1
while t <= T:
	main(t)
	t += 1


for i in range(int(input())):
	n = int(input())
	s = input()
	(l1, lr1, l2, lr2) = (-1, -1, -1, -1)
	mid = n // 2
	seg = False
	if n % 2 == 0:
		for j in range(n):
			if s[j] == '0':
				if j + 1 > mid:
					print(1, j + 1, 1, j)
				else:
					print(j + 1, n, j + 2, n)
				seg = True
				break
	else:
		for j in range(n):
			if s[j] == '0':
				if j + 1 > mid:
					print(1, j + 1, 1, j)
				else:
					print(j + 1, n, j + 2, n)
				seg = True
				break
	if not seg:
		print(1, n - 1, 2, n)


import math
debug = True

def pprint(*args, delimeter='#', amount=10):
	if debug:
		print('{0} DEBUG {0}'.format(delimeter * amount))
		print(*args)
		print('{0} ----- {0}'.format('-' * amount))

def solve():
	n = int(input())
	s = list(input())
	for i in range(n // 2):
		if s[i] == '0':
			print(i + 1, n, i + 2, n)
			return
	for i in range(n // 2, n):
		if s[i] == '0':
			print(1, i + 1, 1, i)
			return
	print(1, n - 1, 2, n)
t = int(input())
while t > 0:
	t -= 1
	solve()


import os
import sys
from io import BytesIO, IOBase
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop
nmbr = lambda : int(input())
lst = lambda : list(map(int, input().split()))

def main():
	for _ in range(nmbr()):
		n = nmbr()
		s = input()
		sz = n // 2
		if '0' not in s:
			print(1, sz, 2, sz + 1)
			continue
		for i in range(n):
			if s[i] == '0':
				if i + 1 - (sz + 1) >= 0:
					ans1 = [i - sz + 1, i + 1]
					ans2 = [i - sz + 1, i]
					break
				elif i + sz + 1 <= n:
					ans2 = [i + 1, i + sz + 1]
					ans1 = [i + 1 + 1, i + sz + 1]
					break
		print(*ans1, *ans2)
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')
for t in range(1):
	main()


from collections import deque
T = int(input())
set1 = set([1, 4, 6, 8, 9])
prime = [False] * 100

def solve():
	n = int(input())
	s = input()
	solved = False
	for i in range(n):
		if s[i] == '0':
			if i >= n // 2:
				print(1, i + 1, 1, i)
			else:
				print(i + 2, n, i + 1, n)
			solved = True
			break
	if not solved:
		print(1, n - 1, 2, n)
for _ in range(T):
	solve()


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	size = n // 2
	if '0' not in s:
		(l1, r1, l2, r2) = (1, size, 2, size + 1)
	else:
		i = s.index('0') + 1
		if i <= size:
			(l1, r1, l2, r2) = (i, n, i + 1, n)
		else:
			(l1, r1, l2, r2) = (1, i, 1, i - 1)
	print(l1, r1, l2, r2)


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	index = s.find('0')
	if index == -1:
		print('{} {} {} {}'.format(1, n - 1, 2, n))
	elif index + 1 <= int(n / 2):
		print('{} {} {} {}'.format(index + 1, n, index + 2, n))
	else:
		print('{} {} {} {}'.format(1, index + 1, 1, index))


import sys, io, os
try:
	input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
except:
	input = lambda : sys.stdin.readline().encode()
read = lambda : map(int, input().split())
from collections import defaultdict as dd
O = []
for _ in range(int(input())):
	n = int(input())
	s = list(map(chr, input().strip()))
	for i in range(n // 2, n):
		if s[i] == '0':
			O.append(f'1 {i + 1} 1 {i}')
			break
	else:
		if s[n // 2 - 1] == '0':
			O.append(f'{n // 2} {n} {n // 2 + 1} {n}')
		else:
			O.append(f'{n // 2} {n - 1} {n // 2 + 1} {n}')
print('\n'.join(O))


t = int(input())
while t:
	n = int(input())
	s = input()
	if '0' not in s:
		print(1, n // 2, n - n // 2 + 1, n)
	else:
		for i in range(n):
			if s[i] == '0':
				if i >= n // 2:
					print(1, i + 1, 1, i)
				else:
					print(i + 1, n, i + 2, n)
				break
	t -= 1


t = int(input())
for i in range(t):
	n = int(input())
	str = input()
	flag = 0
	for j in range(n):
		if str[j] == '0':
			flag = 1
			if j >= n // 2:
				print(1, j + 1, 1, j)
				break
			else:
				print(j + 2, n, j + 1, n)
				break
	if flag != 1:
		if n % 2 == 0:
			print(1, n // 2, n // 2 + 1, n)
		else:
			print(1, n // 2, n // 2 + 2, n)


t = int(input())
while t > 0:
	t -= 1
	l = int(input())
	n = input()
	if '0' in n:
		for i in range(l):
			if n[i] == '0':
				x = i + 1
				break
		if x <= l // 2:
			print(x + 1, l, x, l)
		else:
			print(1, x, 1, x - 1)
	else:
		print(1, l // 2, 2, l // 2 + 1)


import itertools
from sys import maxsize, stdout, stdin, stderr
mod = int(1000000000.0 + 7)
import sys

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

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

def S():
	return list(map(str, input().strip()))

def grid(r, c):
	return [lint() for i in range(r)]
from collections import defaultdict, Counter, deque
import math
import heapq
from heapq import heappop, heappush
import bisect
from math import inf
from itertools import groupby
from itertools import permutations as comb

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

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

def check_prime(n):
	for i in range(2, int(n ** (1 / 2)) + 1):
		if not n % i:
			return False
	return True

def nCr(n, r):
	return fact(n) // (fact(r) * fact(n - r))

def fact(n):
	res = 1
	for i in range(2, n + 1):
		res = res * i
	return res

def primefactors(n):
	num = 0
	while n % 2 == 0:
		num += 1
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			num += 1
			n = n // i
	if n > 2:
		num += 1
	return num

def ask(a):
	print('? {}'.format(a), flush=True)
	n = I()
	return n

def linear_sieve(n):
	is_composite = [False] * n
	prime = []
	for i in range(2, n):
		if not is_composite[i]:
			prime.append(i)
		for j in prime:
			is_composite[i * j] = True
			if i % prime == 0:
				break
	return prime

def dfs(i, p, d):
	(a, tmp) = (0, 0)
	for j in d[i]:
		if j != p:
			a += 1
			tmp += dfs(j, i)
	if a == 0:
		return 0
	return tmp / a + 1

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n // i
	if n > 2:
		l.append(n)
	return l
d = []
primes = []
prim = [0] * (10 ** 5 + 1)

def sieve(n):
	for i in range(n):
		d.append(i)
	for i in range(2, n):
		if d[i] == i:
			prim[i] = 1
			primes.append(i)
		j = 0
		while j < len(primes) and primes[j] <= d[i] and (primes[j] * i < n):
			d[i * primes[j]] = primes[j]
			j += 1

def primeFactors(n):
	factors = []
	while n != 1:
		factors.append(d[n])
		n //= d[n]
	return factors

def func(a):
	b = 1
	res = 0
	for i in range(len(a) - 1, -1, -1):
		res += b * int(a[i])
		b *= 2
	return res
t = I()
for _ in range(t):
	n = I()
	s = S()
	res = False
	for i in range(n - 1, n // 2 - 1, -1):
		if s[i] == '0':
			print(1, i + 1, 1, i)
			res = True
			break
	if not res:
		for i in range(n // 2 - 1, -1, -1):
			if s[i] == '0':
				print(i + 1, n, i + 2, n)
				res = True
				break
	if not res:
		print(1, n // 2, n - n // 2 + 1, n)


from math import floor
for _ in range(int(input())):
	n = int(input())
	s = input()
	for i in range(1, n + 1):
		if int(s[i - 1]) == 0:
			if i <= floor(n / 2):
				print(i, n, i + 1, n)
				break
			else:
				print(1, i, 1, i - 1)
				break
	else:
		print(1, n - 1, 2, n)


for _ in range(int(input())):
	n = int(input())
	s = input()
	m = n // 2 - 1
	f = 0
	zero = []
	for i in range(n):
		if s[i] == '0':
			zero.append(i)
	if len(zero) == 0:
		if n % 2 == 0:
			print(1, n // 2, n // 2 + 1, n)
		else:
			print(1, n // 2, n // 2 + 2, n)
	elif zero[0] <= m:
		print(zero[0] + 1, n, zero[0] + 2, n)
	else:
		print(1, zero[0] + 1, 1, zero[0])


import sys
for _ in range(int(input())):
	n = int(input())
	s = input()
	if '0' not in s:
		print(1, n - 1, 2, n)
	else:
		x = s.index('0') + 1
		if x > n // 2:
			print(1, x, 1, x - 1)
		else:
			print(x, n, x + 1, n)


for t in range(int(input())):
	n = int(input())
	num = str(input())
	zeros = []
	for i in range(n):
		if num[i] == '0':
			zeros.append(i + 1)
	if len(zeros) != 0:
		if zeros[0] <= n // 2:
			l1 = zeros[0]
			r1 = l1 + n // 2
			l2 = l1 + 1
			r2 = r1
		else:
			r2 = zeros[-1]
			l2 = r2 - n // 2
			l1 = l2
			r1 = r2 - 1
		print(l2, r2, l1, r1)
	else:
		print(1, n // 2, 2, 1 + n // 2)


import math, os, io
import random
from sys import stdin, stdout
from collections import Counter, deque, defaultdict
from itertools import product, permutations
import bisect

def getList(method=int):
	return list(map(method, input().split()))

def getInt():
	return int(input())

def solve():
	n = getInt()
	s = input()
	for i in range(n // 2):
		if s[i] == '0':
			return (i + 1, n, i + 2, n)
	for i in range(n // 2, n):
		if s[i] == '0':
			return (1, i + 1, 1, i)
	return (1, n - 1, 2, n)
for _ in range(getInt()):
	print(*solve())


from sys import stdin, setrecursionlimit, maxsize
from collections import deque
from heapq import *
from math import sqrt, gcd
input = stdin.readline
setrecursionlimit(10 ** 5)
for _ in range(int(input())):
	n = int(input())
	s = input().strip()
	solved = 0
	for i in range(n):
		if s[i] == '0':
			solved = 1
			if i >= n // 2:
				print(1, i + 1, 1, i)
				break
			else:
				print(i + 2, n, i + 1, n)
				break
	if solved == 0:
		print(1, n - 1, 2, n)


def work(n, s):
	tar = '0'
	ans = [0] * 4
	if tar in s:
		idx = s.index(tar)
		if idx < n // 2:
			ans = [idx + 1, n, idx + 2, n]
		else:
			ans = [1, idx + 1, 1, idx]
	else:
		ans = [1, n - 1, 2, n]
	for i in ans:
		print(i, end=' ')
	print()
	return

def main():
	test = int(input())
	for _ in range(test):
		n = int(input())
		s = input().strip('\r\n')
		work(n, s)
	return
main()


def f():
	n = int(input())
	s = list(input())
	x = False
	for i in range(n):
		if s[i] == '0':
			x = True
			if i >= n // 2:
				print(1, i + 1, 1, i)
				break
			else:
				print(i + 2, n, i + 1, n)
				break
	if x == False:
		print(1, n - 1, 2, n)
	return
c = int(input())
while c:
	f()
	c -= 1


t = int(input())
for w in range(t):
	n = int(input())
	num = input()
	ln = len(num)
	if '0' in num:
		f0 = num.find('0')
		if f0 > ln // 2 - 1:
			print(1, f0 + 1, 1, f0)
		else:
			print(f0 + 1, ln, f0 + 2, ln)
	else:
		print(1, ln - 1, 2, ln)


t = int(input())
while t:
	t -= 1
	solved = False
	n = int(input())
	s = str(input())
	p = s[:n // 2]
	q = s[n // 2:]
	sp = list(set(p))
	sq = list(set(q))
	if len(sp) == 1 and sp[0] == '1' and (len(sq) == 1) and (sq[0] == '1'):
		print('1 ' + str(n // 2) + ' 2 ' + str(n // 2 + 1))
		continue
	for (i, c) in enumerate(p):
		if c == '0':
			print(str(i + 1) + ' ' + str(n) + ' ' + str(i + 2) + ' ' + str(n))
			solved = True
			break
	if solved:
		continue
	for (i, c) in enumerate(q):
		if c == '0':
			print('1 ' + str(n // 2 + 1 + i) + ' 1 ' + str(n // 2 + i))
			break


from math import ceil
for _ in range(int(input())):
	n = int(input())
	st = input()
	if not st.count('0'):
		print(1, n // 2, ceil(n / 2) + 1, n)
		continue
	rt = st.index('0')
	if rt < n // 2:
		print(rt + 1, n, rt + 2, n)
	elif rt >= n // 2:
		print(1, rt + 1, 1, rt)


t = int(input())
for _ in range(t):
	k = int(input())
	s = input()
	(l1, r1, l2, r2) = (0, 0, 0, 0)
	for i in range(k):
		if s[i] == '0':
			if i >= k // 2:
				l1 = 1
				r1 = i + 1
				l2 = 1
				r2 = i
				break
			elif k - i - 1 >= k // 2:
				l1 = i + 1
				r1 = k
				l2 = i + 2
				r2 = k
				break
	if l1:
		print(l1, r1, l2, r2)
	else:
		print(1, k - 1, 2, k)


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	try:
		p = s.index('0')
		if p < n // 2:
			print(p + 1, n, p + 2, n)
		else:
			print(1, p + 1, 1, p)
	except:
		print(1, n - 1, 2, n)


import math
t = int(input())
kk = t
for _ in range(t):
	n = int(input())
	s = input()
	mid = math.ceil(n / 2)
	if '0' not in s:
		if n % 2 == 1:
			mid -= 1
		print(1, mid, mid + 1, 2 * mid)
		continue
	if '0' in s[0:mid]:
		ind = s.index('0')
		print(ind + 1, n, ind + 2, n)
	else:
		ind = s.index('0')
		print(1, ind + 1, 1, ind)


from collections import Counter
t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	a = Counter(s)
	if '1' in a:
		l = s.index('1')
		if '0' in a:
			r = s[::-1].index('0')
			z = s.index('0') + 1
			if l + 1 < n - r:
				if n - r - 1 >= n // 2 + n % 2:
					print(1, n - r, 1, n - r - 1)
				elif n - z >= n // 2 + n % 2:
					print(z, n, z + 1, n)
				else:
					print(1, n // 2 + n % 2, n // 2 + n % 2, n)
			else:
				print(1, n, 2, n)
		elif n % 2 == 1:
			print(1, n // 2 + n % 2, n // 2 + n % 2, n)
		else:
			print(1, n // 2, n // 2 + 1, n)
	else:
		print(1, n, 1, n - 1)


import os, sys
from io import BytesIO, IOBase

def main():
	for _ in range(int(input())):
		n = int(input())
		s = input().strip()
		if s == '1' * n:
			print(1, n - 1, 2, n)
		else:
			for j in range((n - 1) // 2, -1, -1):
				if s[j] == '0':
					print(j + 1, n, j + 2, n)
					break
			else:
				for j in range(n // 2, n):
					if s[j] == '0':
						print(1, j + 1, 1, j)
						break
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 sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	k = int(input())
	n = input().strip()
	end = 0
	if k % 2 == 0:
		k = k // 2
		for i in range(k, 2 * k):
			if n[i] == '0':
				end = 1
				res = [1, i + 1, 1, i]
				print(' '.join(list(map(str, res))))
				break
		if end:
			continue
		if n[k - 1] == '0':
			res = [k, 2 * k, k + 1, 2 * k]
			print(' '.join(list(map(str, res))))
			continue
		else:
			res = [k, 2 * k - 1, k + 1, 2 * k]
			print(' '.join(list(map(str, res))))
			continue
	else:
		k = k // 2
		for i in range(k, 2 * k + 1):
			if n[i] == '0':
				end = 1
				res = [1, i + 1, 1, i]
				print(' '.join(list(map(str, res))))
				break
		if end:
			continue
		else:
			res = [k + 1, 2 * k, k + 2, 2 * k + 1]
			print(' '.join(list(map(str, res))))


T = int(input())
for t in range(T):
	n = int(input())
	s = input()
	solved = False
	for i in range(n):
		if s[i] == '0':
			solved = True
			if i >= n // 2:
				print(1, i + 1, 1, i)
				break
			else:
				print(i + 2, n, i + 1, n)
				break
	if not solved:
		print(1, n - 1, 2, n)


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

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

def getliststr():
	return list(stdin.readline().split())

def getint():
	return int(stdin.readline().strip())

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

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

def prlist(l):
	stdout.write(' '.join(list(map(str, l))) + '\n')
from sys import stdin, stdout
for _ in range(getint()):
	n = getint()
	s = getstr()
	if '0' in s:
		idx = s.index('0')
		if idx + 1 <= n // 2:
			pr(str(idx + 2) + ' ' + str(n) + ' ' + str(idx + 1) + ' ' + str(n))
		else:
			pr('1 ' + str(idx + 1) + ' ' + '1 ' + str(idx))
	else:
		pr('1 ' + str(n - 1) + ' ' + '2 ' + str(n))


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	k = s.find('0')
	if k == -1:
		print(1, n // 2, n // 2 + 1, n // 2 * 2)
	elif k < n // 2:
		print(k + 1, n, k + 2, n)
	else:
		print(1, k + 1, 1, k)


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input()]
	flag = True
	for i in range(n, 0, -1):
		if a[i - 1] == 0:
			if i > n // 2:
				print(1, i, 1, i - 1)
			else:
				print(i, n, i + 1, n)
			flag = False
			break
	if flag:
		print(1, n - 1, 2, n)


from math import *
t = int(input())
for _ in range(t):
	n = int(input())
	a = input()
	flag = 0
	if n % 2 == 1:
		for i in range(n):
			if a[i] == '0' and i >= floor((n - 1) / 2):
				flag = 1
				ans = i
				break
		if flag == 1:
			print(1, ans + 1, 1, ans)
		else:
			print(n // 2 + 1, n - 1, n // 2 + 2, n)
	else:
		for i in range(n):
			if a[i] == '0' and i > floor((n - 1) / 2):
				flag = 1
				ans = i
				break
		if flag == 1:
			print(1, ans + 1, 1, ans)
		elif a[n // 2 - 1] == '0':
			print(n // 2, n, n // 2 + 1, n)
		else:
			print(n // 2, n - 1, n // 2 + 1, n)


t = int(input())
for i in range(t):
	l = int(input())
	s = input()
	if s.find('0') == -1:
		print(1, l - 1, 2, l)
	elif s.find('0') < l / 2:
		print(s.find('0') + 1, l, s.find('0') + 2, l)
	else:
		print(1, s.find('0') + 1, 1, s.find('0'))


T = int(input())
for _ in range(T):
	n = int(input())
	s = input()
	if s.count('0'):
		pos = s.index('0')
		if pos >= n // 2:
			print(1, pos + 1, 1, pos)
		else:
			print(pos + 1, n, pos + 2, n)
	else:
		print(1, n - 1, 2, n)


def solve(length, num):
	for i in range(0, length // 2):
		if num[i] == '0':
			return [[i + 1, length], [i + 2, length]]
	s = length // 2
	if length % 2 == 1:
		s += 1
	for i in range(s, length):
		if num[i] == '0':
			return [[1, i + 1], [1, i]]
	if length % 2 == 0:
		return [[1, length // 2], [length // 2 + 1, length]]
	else:
		return [[1, length // 2 + 1], [length // 2 + 1, length]]
t = int(input())
for i in range(t):
	l = int(input())
	s = input()
	ans = solve(l, s)
	print(f'{ans[0][0]} {ans[0][1]} {ans[1][0]} {ans[1][1]}')


import os
import sys
from io import BytesIO, IOBase
import math
from queue import Queue
import collections
import itertools
import bisect
import heapq
import random

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')

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

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

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def primeFactors(n):
	cnt = []
	while n % 2 == 0:
		cnt.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			cnt.append(i)
			n = n / i
	if n > 2:
		cnt.append(int(n))
	return cnt

def primeFactorsCount(n):
	cnt = 0
	while n % 2 == 0:
		cnt += 1
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			cnt += 1
			n = n // i
	if n > 2:
		cnt += 1
	return cnt

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 maxPrimeFactors(n):
	maxPrime = -1
	while n % 2 == 0:
		maxPrime = 2
		n >>= 1
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			maxPrime = i
			n = n / i
	if n > 2:
		maxPrime = n
	return int(maxPrime)

def countcon(s, i):
	c = 0
	ch = s[i]
	for i in range(i, len(s)):
		if s[i] == ch:
			c += 1
		else:
			break
	return c

def lis(arr):
	n = len(arr)
	lis = [1] * n
	for i in range(1, n):
		for j in range(0, i):
			if arr[i] > arr[j] and lis[i] < lis[j] + 1:
				lis[i] = lis[j] + 1
	maximum = 0
	for i in range(n):
		maximum = max(maximum, lis[i])
	return maximum

def isSubSequence(str1, str2):
	m = len(str1)
	n = len(str2)
	j = 0
	i = 0
	while j < m and i < n:
		if str1[j] == str2[i]:
			j = j + 1
		i = i + 1
	return j == m

def maxfac(n):
	root = int(n ** 0.5)
	for i in range(2, root + 1):
		if n % i == 0:
			return n // i
	return n

def p2(n):
	c = 0
	while n % 2 == 0:
		n //= 2
		c += 1
	return c

def seive(n):
	primes = [True] * (n + 1)
	primes[1] = primes[0] = False
	i = 2
	while i * i <= n:
		if primes[i] == True:
			for j in range(i * i, n + 1, i):
				primes[j] = False
		i += 1
	pr = []
	for i in range(0, n + 1):
		if primes[i]:
			pr.append(i)
	return pr

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def denofactinverse(n, m):
	fac = 1
	for i in range(1, n + 1):
		fac = fac * i % m
	return pow(fac, m - 2, m)

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

def sod(n):
	s = 0
	while n > 0:
		s += n % 10
		n //= 10
	return s
for xyz in range(0, int(input())):
	n = int(input())
	s = input()
	if len(set(s)) == 1:
		print(1, n - 1, 2, n)
	else:
		s2 = s[::-1]
		pos = n - 1 - s2.index('0')
		if pos < n // 2:
			print(pos + 1, n, pos + 2, n)
		else:
			print(1, pos + 1, 1, pos)


for _ in range(int(input())):
	n = int(input())
	s = input()
	a = s.count('0')
	b = s.count('1')
	t = n // 2 - 1
	if '0' not in s:
		print(1, n - 1, 2, n)
	else:
		for i in range(n - 1, -1, -1):
			if s[i] == '0':
				idx = i
				break
		if idx > t:
			print(1, idx + 1, 1, idx)
		else:
			print(idx + 1, n, idx + 2, n)


for _ in range(int(input())):
	n = int(input())
	s = input()
	if '0' in s:
		ind = s.find('0')
		if ind + 1 <= n // 2:
			print(ind + 1, n, ind + 2, n)
		else:
			print(1, ind + 1, 1, ind)
	else:
		print(1, n // 2 * 2, 1, n // 2)


import os, 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))
try:
	(sys.stdin, sys.stdout) = (open('in.txt', 'r'), open('out.txt', 'w'))
except:
	pass
ii1 = lambda : int(sys.stdin.readline().strip())
is1 = lambda : sys.stdin.readline().strip()
iia = lambda : list(map(int, sys.stdin.readline().strip().split()))
isa = lambda : sys.stdin.readline().strip().split()
mod = int(1000000000.0 + 7)
for _ in range(ii1()):
	n = ii1()
	s = is1()
	solved = False
	for i in range(n):
		if s[i] == '0':
			if i >= n // 2:
				print(1, i + 1, 1, i)
			else:
				print(i + 2, n, i + 1, n)
			solved = True
			break
	if not solved:
		print(1, n - 1, 2, n)


from collections import deque, defaultdict, Counter
from itertools import product, groupby, permutations, combinations, accumulate, zip_longest, combinations_with_replacement
from math import gcd, floor, inf, log2, sqrt, log10, factorial
from bisect import bisect_right, bisect_left
from statistics import mode
from string import ascii_lowercase, ascii_uppercase
from heapq import heapify, heappop, heappush, heappushpop, heapreplace, nlargest, nsmallest, merge
from copy import deepcopy
cases = int(input())
for _ in range(cases):
	num = int(input())
	s = input()
	md = (num + 1) // 2
	if '0' not in s:
		ans = [1, md, md + (num % 2 == 0), num]
	else:
		ind = s.index('0') + 1
		if ind <= md:
			ans = [ind, num, ind + 1, num]
		else:
			ans = [1, ind, 1, ind - 1]
	print(*ans)


def f(s1, s2):
	i = 0
	j = 0
	while j < len(s2):
		if s1[i] == s2[j]:
			i += 1
			j += 1
		else:
			j += 1
		if i == len(s1):
			return True
	return False
t = int(input())
for iii in range(t):
	n = int(input())
	s = input()
	j = -1
	for i in range(len(s)):
		if s[i] == '0':
			j = i
			break
	if j == -1:
		print(1, len(s) - 1, 2, len(s))
		continue
	if j < len(s) // 2:
		print(j + 1, len(s), j + 2, len(s))
	else:
		print(1, j + 1, 1, j)


for _ in range(int(input())):
	n = int(input())
	num = input()
	x = n // 2
	flag = False
	for j in range(n):
		if num[j] == '0':
			i = j
			flag = True
	if flag:
		if i + 1 > x:
			print(1, i + 1, 1, i)
		else:
			print(i + 1, n, i + 2, n)
	elif n % 2:
		print(1, n - 1, 1, n // 2)
	else:
		print(1, n, 1, n // 2)


import sys
import getpass
import math, random
import functools, itertools, collections, heapq, bisect
from collections import Counter, defaultdict, deque
input = sys.stdin.readline
M9 = 10 ** 9 + 7
(yes, no) = ('YES', 'NO')
MAXINT = sys.maxsize
OFFLINE_TEST = getpass.getuser() == 'hkmac'

def log(*args):
	if OFFLINE_TEST:
		print('\x1b[36m', *args, '\x1b[0m', file=sys.stderr)

def solve(*args):
	if OFFLINE_TEST:
		log('----- solving ------')
		log(*args)
		log('----- ------- ------')
	return solve_(*args)

def read_matrix(rows):
	return [list(map(int, input().split())) for _ in range(rows)]

def read_strings(rows):
	return [input().strip() for _ in range(rows)]

def minus_one(arr):
	return [x - 1 for x in arr]

def minus_one_matrix(mrr):
	return [[x - 1 for x in row] for row in mrr]

def solve_(srr):
	k = len(srr)
	left = list(range(k // 2))
	right = list(range((k + 1) // 2, k))
	log(k)
	log(left)
	log(right)
	if srr.count('0') == 0:
		return [1, k - 1, 2, k]
	for pos in left:
		if srr[pos] == '0':
			log('left')
			return [pos + 1, k, pos + 2, k]
	for pos in right:
		if srr[pos] == '0':
			log('right')
			return [1, pos + 1, 1, pos]
	return [k // 2 + 1, k, k // 2 + 2, k]
	return ''
for case_num in range(int(input())):
	k = int(input())
	srr = input().strip()
	res = solve(srr)
	log(res)
	(a, b, c, d) = res
	a -= 1
	c -= 1
	if OFFLINE_TEST:
		(x, y) = (int(srr[a:b], 2), int(srr[c:d], 2))
		if x == y == 0:
			pass
		else:
			assert x % y == 0
	res = ' '.join((str(x) for x in res))
	print(res)


for u in range(int(input())):
	n = int(input())
	x = input()
	if len(set(x)) == 1:
		print(1, n - 1, 2, n)
	else:
		a = x[:n // 2]
		b = x[n // 2 + 1:]
		if '0' in a:
			idx = a.index('0')
			print(idx + 1, n, idx + 2, n)
		elif '0' in x:
			idx = x.index('0')
			print(1, idx + 1, 1, idx)


for _ in range(int(input())):
	l = int(input())
	r = input()
	if '0' in r:
		i = r.index('0') + 1
		if i <= l // 2:
			print(i, l, i + 1, l)
		else:
			print(1, i, 1, i - 1)
	else:
		print(1, l // 2, 2, l // 2 + 1)


from __future__ import division, print_function
import math
import sys
import os
from io import BytesIO, IOBase
from collections import deque, Counter, OrderedDict, defaultdict
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')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def inp():
	return int(input())

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

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

def insr():
	s = input().strip()
	return list(s[:len(s)])

def invr():
	return map(int, input().split())
for _ in range(inp()):
	n = inp()
	s = input().strip()
	flag = 1
	for i in range(n):
		if i <= (n - 1) // 2:
			if s[i] == '0':
				print(i + 1, n, i + 2, n)
				flag = 0
				break
		elif s[i] == '0':
			print(1, i + 1, 1, i)
			flag = 0
			break
	if flag:
		print(1, n // 2, n - n // 2 + 1, n)


import sys
input = sys.stdin.readline
T = int(input())
for iii in range(T):
	n = int(input())
	s = [0] + list(map(int, input()[:-1]))
	ind = -1
	for i in range(1, n + 1):
		if s[i] == 0:
			ind = i
	if ind > n // 2:
		print(1, ind, 1, ind - 1)
		continue
	elif 0 <= ind:
		print(ind, n, ind + 1, n)
	else:
		print(1, 2 * (n // 2), 1, n // 2)


import sys, os, io
input = sys.stdin.readline
PI = 3.141592653589793
INF = float('inf')
MOD = 1000000007

def bin32(num):
	return '{0:032b}'.format(num)

def add(x, y):
	return (x + y) % MOD

def sub(x, y):
	return (x - y + MOD) % MOD

def mul(x, y):
	return x * y % MOD

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

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

def power(x, y):
	res = 1
	x %= MOD
	while y != 0:
		if y & 1:
			res = mul(res, x)
		y >>= 1
		x = mul(x, x)
	return res

def mod_inv(n):
	return power(n, MOD - 2)

def prob(p, q):
	return mul(p, power(q, MOD - 2))

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

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

def ls():
	return [i for i in input().split()]
for t in range(ii()):
	t += 1
	n = ii()
	s = input().strip()
	ind = -1
	for i in range(n - 1, -1, -1):
		if s[i] == '0':
			ind = i
			break
	if ind == -1:
		if n % 2:
			print(1, (n + 1) // 2, (n + 1) // 2, n)
		else:
			print(1, (n + 1) // 2, (n + 1) // 2 + 1, n)
		continue
	ind += 1
	if n % 2:
		if ind >= (n + 1) // 2:
			print(1, ind, 1, ind - 1)
			continue
		else:
			print(ind, n, ind + 1, n)
	elif ind > n // 2:
		print(1, ind, 1, ind - 1)
		continue
	else:
		print(ind, n, ind + 1, n)


from sys import stdin, stdout
from collections import defaultdict
import math

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

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

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

def get_string():
	return stdin.readline()

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

def solve():
	n = get_int()
	s = get_string()
	f = 1
	for i in range(n):
		if s[i] == '0':
			if i >= n // 2:
				print(1, i + 1, 1, i)
			else:
				print(i + 1, n, i + 2, n)
			return
	print(1, n - 1, 2, n)
	return
t = get_int()
while t:
	t -= 1
	solve()


import sys
import math
t = int(sys.stdin.readline())
for _ in range(t):
	line = []
	n = int(sys.stdin.readline())
	rings = sys.stdin.readline()
	if not '0' in rings:
		print('%d %d %d %d' % (1, n // 2, 2, n // 2 + 1))
		continue
	if '0' in rings[:n // 2]:
		at = rings.find('0') + 1
		print('%d %d %d %d' % (at, n, at + 1, n))
		continue
	at = rings.find('0') + 1
	print('%d %d %d %d' % (1, at, 1, at - 1))


tst = int(input())
for t in range(tst):
	n = int(input())
	s = input()
	fst = s.find('0')
	lst = n - s[::-1].find('0') - 1
	if fst == -1:
		k = n // 2
		print(1, 2 * k, 1, k)
		continue
	if lst >= n // 2:
		print(1, lst + 1, 1, lst)
	elif fst < n // 2:
		print(fst + 1, n, fst + 2, n)


import math
for _ in range(int(input())):
	n = int(input())
	A = input()
	if '0' not in A:
		print(1, n - 1, 2, n)
	else:
		k = A.index('0')
		if k < n // 2:
			print(k + 2, n, k + 1, n)
		else:
			print(1, k + 1, 1, k)


from math import gcd
from bisect import bisect_left, bisect_right
from itertools import combinations
from itertools import permutations
from bisect import bisect_left
from math import ceil
from heapq import heapify, heappush, heappop, nsmallest
import bisect
from math import pi
from collections import deque
from math import factorial
from math import log, ceil
from collections import defaultdict
from math import *
from sys import stdin, stdout
import itertools
import os
import sys
import threading
from collections import deque, Counter, OrderedDict, defaultdict
from heapq import *
from fractions import Fraction
mod = int(pow(10, 9) + 7)

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

def si():
	return str(input())

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

def li1():
	return list(mi())

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

def fsi():
	return str(stdin.readline())

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

def fli():
	return list(fmi())
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}

def getKey(item):
	return item[0]

def sort2(l):
	return sorted(l, key=getKey)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

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

def ntl(n):
	return [int(i) for i in str(n)]

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res
graph = defaultdict(list)
visited = [0] * 1000000
col = [-1] * 1000000

def bfs(d, v):
	q = []
	q.append(v)
	visited[v] = 1
	while len(q) != 0:
		x = q[0]
		q.pop(0)
		for i in d[x]:
			if visited[i] != 1:
				visited[i] = 1
				q.append(i)
		print(x)

def make_graph(e):
	d = {}
	for i in range(e):
		(x, y) = mi()
		if x not in d:
			d[x] = [y]
		else:
			d[x].append(y)
		if y not in d:
			d[y] = [x]
		else:
			d[y].append(x)
	return d

def gr2(n):
	d = defaultdict(list)
	for i in range(n):
		(x, y) = mi()
		d[x].append(y)
	return d

def connected_components(graph):
	seen = set()

	def dfs(v):
		vs = set([v])
		component = []
		while vs:
			v = vs.pop()
			seen.add(v)
			vs |= set(graph[v]) - seen
			component.append(v)
		return component
	ans = []
	for v in graph:
		if v not in seen:
			d = dfs(v)
			ans.append(d)
	return ans

def primeFactors(n):
	s = set()
	while n % 2 == 0:
		s.add(2)
		n = n // 2
	for i in range(3, int(sqrt(n)) + 1, 2):
		while n % i == 0 and i % 2 == 1:
			s.add(i)
			n = n // i
	if n > 2 and n % 2 == 1:
		s.add(n)
	return s

def find_all(a_str, sub):
	start = 0
	while True:
		start = a_str.find(sub, start)
		if start == -1:
			return
		yield start
		start += len(sub)

def SieveOfEratosthenes(n, isPrime):
	isPrime[0] = isPrime[1] = False
	for i in range(2, n):
		isPrime[i] = True
	p = 2
	while p * p <= n:
		if isPrime[p] == True:
			i = p * p
			while i <= n:
				isPrime[i] = False
				i += p
		p += 1
	return isPrime

def dijkstra(edges, f, t):
	g = defaultdict(list)
	for (l, r, c) in edges:
		g[l].append((c, r))
	(q, seen, mins) = ([(0, f, ())], set(), {f: 0})
	while q:
		(cost, v1, path) = heappop(q)
		if v1 not in seen:
			seen.add(v1)
			path = (v1, path)
			if v1 == t:
				return (cost, path)
			for (c, v2) in g.get(v1, ()):
				if v2 in seen:
					continue
				prev = mins.get(v2, None)
				next = cost + c
				if prev is None or next < prev:
					mins[v2] = next
					heappush(q, (next, v2, path))
	return float('inf')

def binsearch(a, l, r, x):
	while l <= r:
		mid = l + (r - 1) // 2
		if a[mid]:
			return mid
		elif a[mid] > x:
			l = mid - 1
		else:
			r = mid + 1
	return -1

def readTree(n):
	adj = [set() for _ in range(n)]
	for _ in range(n - 1):
		(u, v) = map(int, input().split())
		adj[u - 1].add(v - 1)
		adj[v - 1].add(u - 1)
	return adj

def treeOrderByDepth(n, adj, root=0):
	parent = [-2] + [-1] * (n - 1)
	ordered = []
	q = deque()
	q.append(root)
	depth = [0] * n
	while q:
		c = q.popleft()
		ordered.append(c)
		for a in adj[c]:
			if parent[a] == -1:
				parent[a] = c
				depth[a] = depth[c] + 1
				q.append(a)
	return (ordered, parent, depth)

def isSubSequence(str1, str2):
	m = len(str1)
	n = len(str2)
	j = 0
	i = 0
	while j < m and i < n:
		if str1[j] == str2[i]:
			j = j + 1
		i = i + 1
	return j == m

def nextPowerOf2(n):
	count = 0
	if n and (not n & n - 1):
		return n
	while n != 0:
		n >>= 1
		count += 1
	return 1 << count

def lastPowerOf2(n):
	count = -1
	if n and (not n & n - 1):
		return n
	while n != 0:
		n >>= 1
		count += 1
	return 1 << count

def cou(n):
	c = 0
	while n > 1:
		c += 1
		n //= 2
	return c

def sortsec(l):
	return sorted(l, key=lambda x: x[1])

def BinarySearch(a, x):
	i = bisect_left(a, x)
	if i:
		return i - 1
	else:
		return -1

def subarray(A):
	r = set()
	p = {0}
	for x in A:
		p = {x | y for y in p} | {x}
		r |= p
	return len(r)

def setBitNumber(n):
	n |= n >> 1
	n |= n >> 2
	n |= n >> 4
	n |= n >> 8
	n |= n >> 16
	n = n + 1
	return n >> 1

def countSetBits(n):
	count = 0
	while n:
		count += n & 1
		n >>= 1
	return count

def allsub(l):
	n = len(l)
	a = []
	for i in range(n - 1):
		a.append([l[:i], l[i:]])
		a.append([l[i:], l[:i]])
	return a

def closestMultiple(n, x):
	if x > n:
		return x
	z = int(x / 2)
	n = n + z
	n = n - n % x
	return n

def block(x):
	v = []
	res = []
	while x > 0:
		v.append(int(x % 2))
		x = int(x / 2)
	for i in range(0, len(v)):
		if v[i] == 1:
			res.append(i)
	return res
for _ in range(ii()):
	n = ii()
	p = 0
	s = si()
	for i in range(1, n + 1):
		if s[i - 1] == '0':
			if i <= n // 2:
				print(i, i + n // 2, i + 1, i + n // 2)
				p = 1
				break
			else:
				print(i - n // 2, i, i - n // 2, i - 1)
				p = 1
				break
	if p == 0:
		print(1, n - 1, 2, n)


from collections import defaultdict as D
from math import *
from sys import stdin, stdout
import itertools
MOD = 10 ** 9 + 7
MAX = 10 ** 18 + 1
MIN = -MAX

def reshape(count, val=0):
	return [val for i in range(count)]

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

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

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

def solve():
	n = int(input())
	s = str(input())
	if '0' not in s:
		print(1, n - 1, 2, n)
		return
	ind = s.find('0') + 1
	if ind <= n // 2:
		print(ind, n, ind + 1, n)
	else:
		print(1, ind, 1, ind - 1)

def test_cases():
	t = int(input())
	while t:
		solve()
		t -= 1
test_cases()


def solve(n, binaryString):
	for i in range(n):
		if binaryString[i] == '0':
			if i < n // 2:
				print(i + 1, n, i + 2, n)
			else:
				print(1, i + 1, 1, i)
			return
	print(2, n // 2 + 1, 1, n // 2)
t = int(input())
for _ in range(t):
	n = int(input())
	binaryString = input()
	solve(n, binaryString)


import math
from collections import defaultdict
from heapq import heappush, heappop
DEBUG = True

def log(*args, **kwargs):
	if DEBUG:
		print(*args, **kwargs)

def ri():
	return int(input())

def rl(f=int):
	return list(map(f, input().split()))

def rs():
	return input()

class Solution:

	def __init__(self):
		pass

	def run(self):
		n = ri()
		s = rs()
		zeros = []
		for i in range(len(s)):
			if s[i] == '0':
				zeros.append(i)
		if len(zeros) == 0:
			if n % 2 == 0:
				print(1, n // 2, n // 2 + 1, n)
			else:
				print(1, n // 2 + 1, n // 2 + 1, n)
			return
		else:
			z = zeros[0]
			if z >= n // 2:
				print(1, z + 1, 1, z)
			else:
				print(z + 2, n, z + 1, n)
			return
t = int(input())
s = Solution()
for i in range(t):
	s.run()


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	ind = -1
	for i in range(n // 2, n):
		if s[i] == '0':
			ind = i
			break
	if ind != -1:
		print(1, ind + 1, 1, ind)
	elif s[n // 2 - 1] == '0':
		print(n // 2 + 1, n, n // 2, n)
	else:
		print(n // 2 + 1, n, n // 2, n - 1)


def naiveSolve():
	return

def solve():
	return

def main():
	t = int(input())
	allans = []
	for _ in range(t):
		n = int(input())
		s = input()
		if '0' in s:
			z = -1
			for i in range(n):
				if s[i] == '0':
					z = i + 1
					break
			if z <= (n + 1) // 2:
				(l1, r1, l2, r2) = (z, n, z + 1, n)
			else:
				(l1, r1, l2, r2) = (1, z - 1, 1, z)
		else:
			(l1, r1, l2, r2) = (1, n - 1, 2, n)
		allans.append((l2, r2, l1, r1))
	multiLineArrayOfArraysPrint(allans)
	return
import sys
input = lambda : sys.stdin.readline().rstrip('\r\n')

def oneLineArrayPrint(arr):
	print(' '.join([str(x) for x in arr]))

def multiLineArrayPrint(arr):
	print('\n'.join([str(x) for x in arr]))

def multiLineArrayOfArraysPrint(arr):
	print('\n'.join([' '.join([str(x) for x in y]) for y in arr]))

def readIntArr():
	return [int(x) for x in input().split()]

def makeArr(defaultValFactory, dimensionArr):
	dv = defaultValFactory
	da = dimensionArr
	if len(da) == 1:
		return [dv() for _ in range(da[0])]
	else:
		return [makeArr(dv, da[1:]) for _ in range(da[0])]

def queryInteractive(x):
	print('{}'.format(x))
	sys.stdout.flush()
	return int(input())

def answerInteractive(ans):
	print('! {}'.format(ans))
	sys.stdout.flush()
inf = float('inf')
from math import gcd, floor, ceil
for _abc in range(1):
	main()


from sys import stdin
input = stdin.readline

def solution():
	n = int(input())
	A = list(map(int, input().rstrip()))
	L = n // 2
	if 0 not in A:
		print(1, L, 2, L + 1)
		return
	for i in range(n):
		if i + L >= n:
			break
		if A[i] == 0:
			print(i + 1, i + L + 1, i + 2, i + L + 1)
			return
	for i in range(n - 1, -1, -1):
		if A[i] == 0:
			print(i - L + 1, i + 1, i - L + 1, i)
			return
T = int(input())
for _ in range(T):
	solution()


t = int(input())
for w in range(t):
	n = int(input())
	st = input()
	find = False
	for i in range(n // 2):
		if st[i] == '0':
			print(i + 1, n, i + 2, n, sep=' ')
			find = True
			break
	if not find:
		for i in range(n // 2, n):
			if st[i] == '0':
				print(1, i + 1, 1, i, sep=' ')
				find = True
				break
	if not find:
		print(1, n - 1, 2, n, sep=' ')


def f():
	n = int(input())
	s = input()
	for i in range(n):
		if s[i] == '0':
			if i < n // 2:
				print(i + 1, n, i + 2, n)
				return
			else:
				print(1, i + 1, 1, i)
				return
	print(1, n - 1, 2, n)
t = int(input())
while t:
	f()
	t -= 1


testcases = int(input())
while testcases:
	d = int(input())
	num = input()
	if '0' in num:
		index = num.find('0')
		if index + 1 <= d // 2:
			l1 = index
			r1 = d - 1
			l2 = l1 + 1
			r2 = d - 1
		else:
			l1 = 0
			l2 = 0
			r1 = index
			r2 = r1 - 1
	else:
		l1 = 0
		r1 = d - 2
		l2 = 1
		r2 = d - 1
	print(l1 + 1, r1 + 1, l2 + 1, r2 + 1)
	testcases -= 1


for i in range(int(input())):
	n = int(input())
	a = list(input())
	if '0' in a:
		ind = a.index('0')
		if ind + 1 >= n // 2 + 1:
			print(1, ind + 1, 1, ind)
		else:
			print(ind + 1, n, ind + 2, n)
	else:
		print(1, n - 1, 2, n)


for i in range(int(input())):
	n = int(input())
	s = input()
	x = n // 2
	if '0' in s:
		a = s.index('0') + 1
		if a <= x:
			print(a, n, a + 1, n)
		else:
			print(1, a, 1, a - 1)
	else:
		print(1, x, 2, x + 1)


for _ in range(int(input())):
	n = int(input())
	s = input()
	if '0' in s[:n // 2]:
		x = s.index('0')
		print(x + 1, n, x + 2, n)
		continue
	if '0' in s[-(n // 2):]:
		x = s.rindex('0')
		print(1, x + 1, 1, x)
		continue
	if n % 2 == 0:
		print(1, n // 2, n // 2 + 1, n)
	else:
		print(1, n // 2, n // 2 + 2, n)


t = int(input())
for l in range(t):
	n = int(input())
	s = input()
	if s.count('0') == 0:
		print(1, n - 1, 2, n)
	else:
		s1 = ''
		j = 0
		for i in range(len(s)):
			if s[i] == '0':
				if i >= n // 2:
					print(1, i + 1, 1, i)
					break
				else:
					print(i + 2, len(s), i + 1, len(s))
					break


import sys
for _ in range(int(sys.stdin.readline())):
	k = int(sys.stdin.readline())
	data = sys.stdin.readline().rstrip()
	idx = -1
	for i in range(len(data)):
		if data[i] == '0':
			idx = i + 1
			break
	if idx == -1:
		print(f'1 {k - 1} 2 {k}')
	else:
		mid = k // 2
		if idx <= mid:
			print(f'{idx} {k} {idx + 1} {k}')
		else:
			print(f'{1} {idx} {1} {idx - 1}')


import sys

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

def maps():
	return [int(i) for i in input().split()]
for _ in range(*maps()):
	(n,) = maps()
	s = input()
	if len(set(s)) == 1:
		print(1, n - 1, 2, n)
		continue
	k = n // 2
	for i in range(n):
		if s[i] == '0':
			idx = i + 1
			if idx <= k:
				print(idx, n, idx + 1, n)
				break
			elif idx > k:
				print(1, idx, 1, idx - 1)
				break


import os, 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 ceil
mod = 10 ** 9 + 7
for _ in range(int(input())):
	n = int(input())
	s = input()
	f = 0
	zeroes = 0
	for i in range(n):
		if s[i] == '0':
			zeroes += 1
		else:
			zeroes = 0
		if zeroes == n // 2:
			print(i - zeroes + 2, i + 1, 1, n)
			f = 1
			break
	if f:
		continue
	for i in range(n // 2, n):
		if s[i] == '0':
			print(1, i + 1, 1, i)
			f = 1
			break
	if f:
		continue
	mid = (n - 1) // 2
	if s[mid] == '1':
		print(mid + 1, n - 1, mid + 2, n)
	else:
		print(mid + 1, n, mid + 2, n)


import sys
input = sys.stdin.readline

def main():
	n = int(input())
	S = input()
	if '0' not in S:
		d = n // 2 * 2
		print(1, d, 1, d // 2)
		return
	ind = S.index('0') + 1
	if ind <= (n + 1) // 2:
		print(ind, n, ind + 1, n)
	else:
		print(1, ind, 1, ind - 1)
for _ in range(int(input())):
	main()


for i in range(int(input())):
	n = int(input())
	s = input()
	k = s.find('0')
	if k == -1:
		print(1, n // 2, n // 2 + 1, n // 2 * 2)
	elif k < n // 2:
		print(k + 1, n, k + 2, n)
	else:
		print(1, k + 1, 1, k)


T = int(input())

def convert(s):
	s = s[::-1]
	ans = 0
	for i in range(len(s)):
		if s[i] == '1':
			ans += 1 << i
	return ans

def solve():
	n = int(input())
	s = input()
	k = s.find('0')
	if k == -1:
		print(1, n // 2, n // 2 + 1, n // 2 * 2)
	elif k < n // 2:
		print(k + 1, n, k + 2, n)
	else:
		print(1, k + 1, 1, k)
for i in range(T):
	solve()


def sex(n, s):
	for i in range(n // 2):
		if s[i] == '0':
			print(i + 1, n, i + 2, n)
			return
	for i in range(n // 2, n):
		if s[i] == '0':
			print(1, i + 1, 1, i)
			return
	print(1, n - 1, 2, n)
	return
t = int(input())
for _ in range(t):
	n = int(input())
	s = str(input())
	sex(n, s)


from sys import stdin
read = lambda : stdin.readline()
for _ in range(int(read())):
	n = int(read())
	s = list(read())
	s.pop()
	try:
		zidx = s.index('0') + 1
	except:
		print(1, n - 1, 2, n)
		continue
	if zidx <= n // 2:
		print(zidx, n, zidx + 1, n)
	else:
		print(1, zidx, 1, zidx - 1)


from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	s = input().rstrip()
	idx = None
	cnt0 = s.count('0')
	cnt1 = n - cnt0
	if cnt1 == 0:
		print(1, n // 2 + 1, 1, n // 2)
		continue
	if cnt0 == 0:
		print(2, n // 2 + 1, 1, n // 2)
		continue
	for x in range(n):
		if s[x] == '0':
			idx = x + 1
			break
	if idx <= n // 2:
		print(idx, idx + n // 2, idx + 1, idx + n // 2)
	else:
		print(idx - n // 2, idx, idx - n // 2, idx - 1)


for _ in range(int(input())):
	n = int(input())
	s = input()
	i = 0
	done = False
	while i < n // 2:
		if s[i] == '0':
			print(i + 1, n, i + 2, n)
			done = True
			break
		i += 1
	if done:
		continue
	i = n // 2
	while i < n:
		if s[i] == '0':
			print(1, i + 1, 1, i)
			done = True
			break
		i += 1
	if done:
		continue
	print(1, n - 1, 2, n)


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')
if os.path.exists('input.txt'):
	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')
for t in range(int(input())):
	n = int(input())
	s = input()
	if '0' in s:
		i = s.index('0')
		if i < n // 2:
			print(i + 1, n, i + 2, n)
		else:
			print(1, i + 1, 1, i)
	else:
		x = n // 2
		print(1, x * 2, 1, x)


import math, bisect, heapq, random, sys, itertools
ints = lambda : list(map(int, input().split()))
p = 10 ** 9 + 7
alpha = 'abcdefghijklmnopqrstuvwxyz'
primes = []
for i in range(2, 100):
	x = 0
	for j in range(2, int(i ** 0.5) + 1):
		if i % j == 0:
			x = 1
			break
	if x == 1:
		primes.append(i)
primes = set(primes)
for t in range(int(input())):
	n = int(input())
	a = input()
	if a == '11':
		print(1, 2, 1, 1)
	elif a == '111':
		print(1, 2, 1, 1)
	elif '0' not in a:
		x = n // 2
		print(1, x * 2, 1, x)
	else:
		x = a.index('0')
		if x >= (n + 1) // 2:
			print(1, x + 1, 1, x)
		else:
			print(x + 1, n, x + 2, n)


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
from bisect import bisect_left as lower_bound, bisect_right as upper_bound

def so():
	return int(input())

def st():
	return input()

def mj():
	return map(int, input().strip().split(' '))

def msj():
	return map(str, input().strip().split(' '))

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

def lebe():
	return list(map(int, input()))

def dmain():
	sys.setrecursionlimit(1000000)
	threading.stack_size(1024000)
	thread = threading.Thread(target=main)
	thread.start()

def joro(L):
	return ''.join(map(str, L))

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

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

def npr(n, r):
	return factorial(n) // factorial(n - r) if n >= r else 0

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(n - r)) if n >= r else 0

def lower_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] >= num:
			answer = middle
			end = middle - 1
		else:
			start = middle + 1
	return answer

def upper_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] <= num:
			answer = middle
			start = middle + 1
		else:
			end = middle - 1
	return answer

def abs(x):
	return x if x >= 0 else -x

def binary_search(li, val, lb, ub):
	ans = -1
	while lb <= ub:
		mid = (lb + ub) // 2
		if li[mid] > val:
			ub = mid - 1
		elif val > li[mid]:
			lb = mid + 1
		else:
			ans = mid
			break
	return ans

def kadane(x):
	sum_so_far = 0
	current_sum = 0
	for i in x:
		current_sum += i
		if current_sum < 0:
			current_sum = 0
		else:
			sum_so_far = max(sum_so_far, current_sum)
	return sum_so_far

def pref(li):
	pref_sum = [0]
	for i in li:
		pref_sum.append(pref_sum[-1] + i)
	return pref_sum

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	li = []
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, len(prime)):
		if prime[p]:
			li.append(p)
	return li

def primefactors(n):
	factors = []
	while n % 2 == 0:
		factors.append(2)
		n //= 2
	for i in range(3, int(sqrt(n)) + 1, 2):
		while n % i == 0:
			factors.append(i)
			n //= i
	if n > 2:
		factors.append(n)
	return factors

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def tr(n):
	return n * (n + 1) // 2

def fb(k, L):
	if k == L[k]:
		return k
	if L[k] == fb(L[k], L):
		return L[k]

def usa(a, b, Y, Z):
	a = fb(a, Y)
	b = fb(b, Y)
	if a != b:
		if Z[a] < Z[b]:
			(a, b) = (b, a)
		Y[b] = a
		Z[a] += Z[b]

def se(s, t):
	j = 0
	for i in range(len(s)):
		if s[i] == t[j]:
			j += 1
		if j >= len(t):
			return 1
	return 0

def iu():
	import sys
	input = sys.stdin.buffer.readline
	import math as my
	p = so()
	q = st()
	ok = 1
	c = 0
	itt = 0
	it = 0
	for i in range(p - 1, -1, -1):
		if q[i] == '0' and ok == 1:
			it = 1 + i
			ok = 0
		if q[i] == '0':
			c += 1
	for i in range(p):
		if q[i] == '0':
			itt = 1 + i
			break
	if c == 0:
		if p % 2 != 0:
			print(1, (p + 1) // 2, (p + 1) // 2, p)
			return
		else:
			print(1, p // 2, p // 2 + 1, p)
			return
	if it >= (p + 1) // 2 + 1:
		print(1, it, 1, it - 1)
	elif c == 1 and p % 2 != 0 and (itt == (p + 1) // 2):
		print(1, it, it, p)
	else:
		print(itt, p, 1 + itt, p)

def main():
	for i in range(so()):
		iu()
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')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


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():
	k = nn()
	n = input()
	n = list(str(n))[:-1]
	n = [int(dig) for dig in n]
	for i in range(k // 2):
		if n[i] == 0:
			print(i + 1, k, i + 2, k)
			return
	for j in range(k // 2, k):
		if n[j] == 0:
			print(1, j + 1, 1, j)
			return
	print(1, k - 1, 2, k)
	return
q = nn()
for _ in range(q):
	solve()


for _ in range(int(input())):
	n = int(input())
	s = input()
	k = n // 2
	if '0' in s:
		x = 1 + s.index('0')
		if x > n // 2:
			print(1, x, 1, x - 1)
		else:
			print(x, x + n // 2, x + 1, n // 2 + x)
	else:
		print(1, n // 2, 2, n // 2 + 1)


for i in range(int(input())):
	n = int(input())
	s = input()
	if '0' in s:
		x = s.find('0')
		if x < n // 2:
			print(x + 1, n, x + 2, n)
		else:
			print(1, x + 1, 1, x)
	else:
		print(1, n // 2, n // 2 + 1, n // 2 + n // 2)


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	s = list(input().rstrip())
	x = n // 2 - 1
	ans = [-1, -1, -1, -1]
	for i in range(n // 2):
		j = n - i - 1
		if s[j] == '0':
			ans = [1, j + 1, 1, j]
			break
	if ans[0] == -1:
		for i in range(n // 2):
			if s[i] == '0':
				ans = [i + 1, n, i + 2, n]
				break
	if ans[0] == -1:
		if s[n // 2] == '1':
			ans = [1, n - 1, 2, n]
		else:
			ans = [1, n, n // 2 + 1, n]
	print(*ans)


tt = int(input())
for _ in range(tt):
	n = int(input())
	s = input()
	i = s.find('0')
	if i == -1:
		m = n - n % 2
		j = m // 2
		print(1, m, 1, j)
	elif i < n // 2:
		print(i + 2, n, i + 1, n)
	else:
		print(1, i + 1, 1, i)


import sys

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		s = input()
		zero = -1
		for (i, x) in enumerate(s):
			if x == '0':
				zero = i
				break
		if zero == -1:
			k = n // 2
			print(1, 2 * k, 1, k)
		elif zero >= n // 2:
			print(1, zero + 1, 1, zero)
		else:
			print(zero + 1, n, zero + 2, n)
import os
import sys
from io import BytesIO, IOBase
_str = str
str = lambda x=b'': x if type(x) is bytes else _str(x).encode()
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()


from math import ceil
for i in range(int(input())):
	n = int(input())
	arr = list(input())
	if '0' not in arr:
		print(1, n // 2, ceil(n / 2) + 1, 2 * n // 2)
	else:
		idx = arr.index('0')
		if idx < n // 2:
			print(idx + 1, n, idx + 2, n)
		else:
			print(1, idx + 1, 1, idx)


import sys, collections
tc = int(sys.stdin.readline())
for _ in range(tc):
	n = int(sys.stdin.readline())
	arr = [-1] + list(map(int, sys.stdin.readline().rstrip()))
	idx = -1
	for i in range(1, n + 1):
		if arr[i] == 0:
			idx = i
			break
	if idx == -1:
		if n % 2 == 0:
			print(1, n // 2, n // 2 + 1, n)
		else:
			print(1, n // 2, n // 2 + 2, n)
	else:
		left = arr[1:idx + 1]
		right = arr[idx:n + 1]
		if len(left) >= n // 2 and len(left) - 1 >= n // 2:
			print(1, idx, 1, idx - 1)
		elif len(right) >= n // 2 and len(right) - 1 >= n // 2:
			print(idx, n, idx + 1, n)


t = int(input())
for w in range(t):
	n = int(input())
	code = input()
	N = []
	for i in range(n):
		if code[i] == '0':
			N.append(i + 1)
	if N == []:
		print(1, n - 1, 2, n)
	elif N[-1] > n // 2:
		print(1, N[-1], 1, N[-1] - 1)
	else:
		print(N[0], n, N[0] + 1, n)


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

def si():
	return input()

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

def msi():
	return map(str, input().split())

def li():
	return list(mi())
t = ii()
for _ in range(t):
	n = ii()
	s = si()
	if s.count('0') == 0:
		print(1, n - 1, 2, n)
	else:
		(l, r) = (-1, -1)
		for i in range(n // 2):
			if s[i] == '0':
				l = i
				break
		for i in range(n // 2, n):
			if s[i] == '0':
				r = i
				break
		if l != -1:
			print(l + 1, n, l + 2, n)
		else:
			print(1, r + 1, 1, r)


import sys
import typing

def rl(proc=None) -> typing.Any:
	if proc is not None:
		return proc(sys.stdin.readline())
	else:
		return sys.stdin.readline().rstrip()

def srl(proc=None) -> typing.List[typing.Any]:
	if proc is not None:
		return list(map(proc, rl().split()))
	else:
		return rl().split()

def main():
	T = rl(int)
	for _ in range(1, T + 1):
		n = rl(int)
		s = rl()
		assert len(s) == n
		half = len(s) // 2
		pos = s.find('0')
		if pos >= 0:
			if pos < half:
				print(pos + 1, len(s), pos + 2, len(s))
			else:
				print(1, pos + 1, 1, pos)
		else:
			print(1, 2 * half, 1, half)
main()


for q in range(int(input())):
	d = int(input())
	n = ' ' + input()
	if '0' in n:
		c = n.index('0')
		if c <= d // 2:
			print(c, d, c + 1, d)
		else:
			print(1, c, 1, c - 1)
	else:
		print(1, d // 2, 2, d // 2 + 1)


t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	s = str(input())
	done = False
	nst = int(n / 2)
	for i in range(nst, n, 1):
		like = 6
		if like == 6:
			if s[i] == '0':
				print(1, i + 1, 1, i)
				done = True
				break
		else:
			print(1, i + 1, 1, i)
			done = True
			break
	if done:
		continue
	if n % 2:
		if like == 6:
			print(int(n / 2) + 1, n - 1, int(n / 2) + 2, n)
		else:
			print(1, i + 1, 1, i)
	elif s[int(n / 2) - 1] == '0':
		print(int(n / 2), n, int(n / 2) + 1, n)
	else:
		print(int(n / 2), n - 1, int(n / 2) + 1, n)


from io import BytesIO, IOBase
import sys
import math
import os
import heapq
from collections import defaultdict, deque
from math import ceil
from bisect import bisect_left, bisect_left
from time import perf_counter
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 mint():
	return map(int, input().split())

def mfloat():
	return map(float, input().split())

def intin():
	return int(input())

def solve():
	n = intin()
	s = input()
	if n <= 3:
		x = s.find('1')
		if x == 0:
			print(2, 2, 1, 1)
		else:
			if x == -1:
				x = 1
			print(1, 1, x + 1, x + 1)
		return
	last_zero = s.rfind('0')
	min_length = n // 2 - 1
	if last_zero > min_length:
		print(1, last_zero + 1, 1, last_zero)
		assert last_zero - 1 + 1 >= n // 2
	elif last_zero != -1:
		print(last_zero + 1, n, last_zero + 2, n)
		assert n - last_zero - 2 + 1 >= n // 2
	else:
		print(1, n // 2 * 2, 1, n // 2)

def main():
	t = 1
	t = int(input())
	for _ in range(t):
		solve()
start_time = perf_counter()
main()
print(perf_counter() - start_time, file=sys.stderr)


for _ in range(int(input())):
	n = int(input())
	s = input()
	till = len(s) // 2
	left = s[:till]
	after = len(s) // 2 + (1 if len(s) % 2 == 1 else 0)
	right = s[after:]
	if left == right:
		print(1, till, after + 1, n)
	elif '0' in left:
		ind = left.index('0')
		print(ind + 1, n, ind + 2, n)
	elif '0' in right:
		ind = s.index('0')
		print(1, ind + 1, 1, ind)


import sys
import bisect
from bisect import bisect_left as lb
from bisect import bisect_right as rb
input_ = lambda : sys.stdin.readline().strip('\r\n')
from math import log
from math import gcd
from math import atan2, acos
from random import randint
sa = lambda : input_()
sb = lambda : int(input_())
sc = lambda : input_().split()
sd = lambda : list(map(int, input_().split()))
sflo = lambda : list(map(float, input_().split()))
se = lambda : float(input_())
sf = lambda : list(input_())
flsh = lambda : sys.stdout.flush()
mod = 10 ** 9 + 7
mod1 = 998244353
gp = []
cost = []
dp = []
mx = []
ans1 = []
ans2 = []
special = []
specnode = []
a = 0
kthpar = []

def dfs2(root, par):
	if par != -1:
		dp[root] = dp[par] + 1
	for i in range(1, 20):
		if kthpar[root][i - 1] != -1:
			kthpar[root][i] = kthpar[kthpar[root][i - 1]][i - 1]
	for child in gp[root]:
		if child == par:
			continue
		kthpar[child][0] = root
		dfs(child, root)
ans = 0
b = []
vis = []
tot = 0
time = []
time1 = []
adj = []
mx = -1
eps = 1e-07

def dfs(a, b, p, c):
	if a == b:
		return c
	for (i, j) in adj[a]:
		if i == p:
			continue
		temp = dfs(i, b, a, c + j)
		if dfs(i, b, a):
			mx = max(i, mx)
			return 1
	return tot
ans = 0
dig = {}
s = 0
k = 0
num = ['1']
for i in range(2, 100):
	for j in range(2, i):
		if i % j == 0:
			num.append(str(i))
			break

def hnbhai(tc):
	k = sb()
	n = sa()
	idx = -1
	for i in range(k // 2):
		if n[i] == '0':
			idx = i
			break
	if idx != -1:
		print(idx + 1, k, idx + 2, k)
		return
	for i in range(k // 2, k):
		if n[i] == '0':
			idx = i
			break
	if idx != -1:
		print(1, idx + 1, 1, idx)
		return
	print(1, k // 2, 2, k // 2 + 1)
for _ in range(sb()):
	hnbhai(_ + 1)


import sys
from math import gcd, ceil, sqrt
import bisect
INF = float('inf')
MOD = 998244353
mod = 10 ** 9 + 7
from collections import Counter, defaultdict as df
from functools import reduce

def counter(l):
	return dict(Counter(l))

def printm(l):
	for i in range(len(l[0])):
		print(*l[i])

def P(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	for i in range(5, ceil(sqrt(n)) + 1, 6):
		if n % i == 0 or n % (i + 2) == 0:
			return False
	return True

def so(x):
	return {k: v for (k, v) in sorted(x.items(), key=lambda item: item[1])}

def rev(l):
	return list(reversed(l))

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

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

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

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

def inputm(n, m):
	return [li() for i in range(m)]

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
for _ in range(ini()):
	n = ini()
	s = input()
	c = 0
	for i in range(n // 2):
		if s[i] == '0':
			print(i + 1, i + n // 2 + 1, i + 1 + 1, i + n // 2 + 1)
			c = 1
			break
	if c:
		continue
	for i in range(n - n // 2, n):
		if s[i] == '0':
			print(i - n // 2 + 1, i + 1, i - n // 2 + 1, i)
			c = 1
			break
	if c:
		continue
	if '0' not in s:
		print(1, n // 2, n // 2 + 1, n // 2 * 2)
	else:
		print(n // 2 + 1, n, n // 2 + 2, n)


import bisect
import heapq
import math
import collections
import sys
import copy
from functools import reduce
import decimal
from io import BytesIO, IOBase
import os
import itertools
import functools
from types import GeneratorType
sys.setrecursionlimit(10 ** 9)
decimal.getcontext().rounding = decimal.ROUND_HALF_UP
graphDict = collections.defaultdict
queue = collections.deque

def bootstrap(f, stack=[]):

	def wrappedfunc(*args, **kwargs):
		to = f(*args, **kwargs)
		if stack:
			return to
		else:
			while True:
				if type(to) is GeneratorType:
					stack.append(to)
					to = next(to)
				else:
					stack.pop()
					if not stack:
						return to
					to = stack[-1].send(to)
	return wrappedfunc

class Graphs:

	def __init__(self):
		self.graph = graphDict(set)

	def add_edge(self, u, v):
		self.graph[u].add(v)
		self.graph[v].add(u)

	def dfs_utility(self, nodes, visited_nodes, psf):
		global ans
		if len(visited_nodes.keys()) == n:
			ans = psf
			return
		visited_nodes[nodes] = None
		for neighbour in self.graph[nodes]:
			if neighbour not in visited_nodes:
				self.dfs_utility(neighbour, visited_nodes, psf + [neighbour])
		visited_nodes.pop(nodes)
		return

	def dfs(self, node):
		global ans
		Visited = collections.OrderedDict()
		self.dfs_utility(node, Visited, [node])

	def bfs(self, node):
		visited = set()
		if node not in visited:
			queue.append(node)
			visited.add(node)
		while queue:
			parent = queue.popleft()
			print(parent)
			for item in self.graph[parent]:
				if item not in visited:
					queue.append(item)
					visited.add(item)

class Tree:

	def __init__(self, data):
		self.data = data
		self.left = None
		self.right = None

def inorder(node, lis):
	if node:
		inorder(node.left, lis)
		lis.append(node.data)
		inorder(node.right, lis)
	return lis

def leaf_node_sum(root):
	if root is None:
		return 0
	if root.left is None and root.right is None:
		return root.data
	return leaf_node_sum(root.left) + leaf_node_sum(root.right)

def hight(root):
	if root is None:
		return -1
	if root.left is None and root.right is None:
		return 0
	return max(hight(root.left), hight(root.right)) + 1

def rounding(n):
	return int(decimal.Decimal(f'{n}').to_integral_value())

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), []))

def p_sum(array):
	return list(itertools.accumulate(array))
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, **kwargs):
		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 inp():
	return sys.stdin.readline().strip()

def map_inp(v_type):
	return map(v_type, inp().split())

def list_inp(v_type):
	return list(map_inp(v_type))
for _ in range(int(inp())):
	n = int(inp())
	s = inp()
	if s.count('0'):
		x = s.index('0')
		if n - (x + 2) + 1 >= n // 2:
			print(x + 1, n, x + 2, n)
		else:
			x = s.rfind('0')
			print(1, x + 1, 1, x)
	else:
		print(1, n - 1, 2, n)


def doWork():
	k = int(input())
	s = input()
	ind = s.find('0')
	if ind == -1:
		print(1, k - 1, 2, k)
	elif ind < k // 2:
		print(ind + 2, k, ind + 1, k)
	else:
		print(1, ind + 1, 1, ind)
t = int(input())
for _ in range(t):
	doWork()


for case in range(int(input())):
	n = int(input())
	n = [int(i) for i in input()]
	for i in range(len(n)):
		if n[i] == 0:
			if i < len(n) // 2:
				print(i + 1, len(n), i + 2, len(n))
			else:
				print(1, i + 1, 1, i)
			break
	else:
		print(1, len(n) - 1, 2, len(n))


import math
count = int(input())
data = []
for i in range(count):
	x = int(input())
	n = input()
	data.append([x, n])
for d in data:
	n = d[0]
	s = d[1]
	if s == '1' * n:
		print(1, 2 * math.floor(n / 2), 1, math.floor(n / 2))
	elif '0' in s[:math.ceil(n / 2)]:
		i = s.index('0')
		print(i + 1, n, i + 2, n)
	else:
		i = s.index('0')
		print(1, i + 1, 1, i)


for _ in range(int(input())):
	n = int(input())
	s = input()
	k = int(n // 2)
	done = False
	for i in range(k, n):
		if s[i] == '0':
			print(1, i + 1, 1, i)
			done = True
			break
	if not done:
		if n & 1:
			print(k + 1, n - 1, k + 2, n)
		elif s[k - 1] == '1':
			print(k, n - 1, k + 1, n)
		else:
			print(k, n, k + 1, n)


import sys
import math
from bisect import bisect_right as br
from itertools import combinations as cb

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

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

def input():
	return sys.stdin.readline().strip()
for _ in range(int(input())):
	n = int(input())
	st = input()
	if '0' not in st:
		print(1, math.ceil(n // 2), 2, math.ceil(n // 2) + 1)
		continue
	else:
		ind = st.index('0') + 1
		if ind <= math.ceil(n // 2):
			print(ind, n, ind + 1, n)
		else:
			print(1, ind, 1, ind - 1)


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	flag = False
	for j in range(n):
		if s[j] == '0':
			flag = True
			if j < n // 2:
				print(j + 2, n, j + 1, n)
				break
			elif j >= n // 2:
				print(1, j + 1, 1, j)
				break
	if flag == False:
		print(1, n - 1, 2, n)


import sys
input = sys.stdin.readline
t = int(input())
for you in range(t):
	n = int(input())
	s = input()
	poss = 0
	for i in range(n // 2):
		if s[i] == '0':
			poss = 1
			print(i + 1, n, end=' ')
			print(i + 2, n, end=' ')
			print()
			break
	if poss:
		continue
	for i in range(n // 2, n):
		if s[i] == '0':
			poss = 1
			print(1, i + 1, end=' ')
			print(1, i, end=' ')
			print()
			break
	if poss:
		continue
	print(1, n // 2, n // 2 + 1, n // 2 + n // 2)


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	count1 = 0
	first = 0
	for i in range(len(s)):
		if s[i] == '1':
			count1 += 1
		if s[i] == '0':
			first = i
	if count1 == len(s):
		print(1, len(s) - 1, 2, len(s))
		continue
	if first < len(s) // 2:
		print(first + 1, len(s), first + 2, len(s))
	else:
		print(1, first + 1, 1, first)


def func():
	if '0' not in s:
		print(1, n - 1, 2, n)
	else:
		ind = s.index('0')
		if ind < n // 2:
			print(ind + 1, n, ind + 2, n)
		else:
			print(1, ind + 1, 1, ind)
for _ in range(int(input())):
	n = int(input())
	s = input()
	func()


try:
	import sys
	from functools import lru_cache, cmp_to_key
	from heapq import merge, heapify, heappop, heappush
	from math import *
	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, insort
	from time import perf_counter
	from fractions import Fraction
	import copy
	from copy import deepcopy
	import time
	starttime = time.time()
	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)]
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
for _ in range(L()[0]):
	n = L()[0]
	s = input()
	if '0' in s:
		x = s.index('0')
		if x >= n // 2:
			print(1, x + 1, 1, x)
			s = '0' + s
		else:
			print(x + 2, x + n // 2 + 1, x + 1, x + n // 2 + 1)
			s = '0' + s
	else:
		n -= n % 2
		print(1, n, 1, n // 2)
		s = '0' + s


import sys
import math
import random
import heapq
input = sys.stdin.readline

def pow(a, n, m):
	if n == 0:
		return 1
	x = pow(a, n // 2, m)
	if n % 2 == 0:
		return x * x % m
	else:
		return x * x * a % m

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

def bs(arr, le, ri):
	l = 0
	arr.sort()
	r = len(arr) - 1
	ans = 10000000
	while l <= r:
		m = (l + r) // 2
		if arr[m] >= le and arr[m] <= ri:
			ans = arr[m]
			r = m - 1
		elif arr[m] < le:
			l = m + 1
		else:
			r = m - 1
	return ans
t = int(input())
while t > 0:
	n = int(input())
	s = input().strip()
	f = 0
	for i in range(n - n // 2):
		if s[i] == '0':
			print(i + 1, n, i + 2, n)
			f = 1
			break
	if f == 0:
		if '0' in s:
			for i in range(n):
				if s[i] == '0':
					print(1, i + 1, 1, i)
					break
		else:
			print(1, n - 1, 2, n)
	t -= 1


from collections import Counter
from functools import reduce
from math import acos, ceil, cos, floor, pi, sin, sqrt, log10
from random import random
from string import ascii_lowercase, ascii_uppercase, digits
from sys import exit, setrecursionlimit, stdin
dX = [-1, 1, 0, 0, -1, 1, -1, 1]
dY = [0, 0, -1, 1, 1, -1, -1, 1]
mod = int(1000000000.0 + 7)
eps = 1e-06
MAX = 3 * 10 ** 5 + 10
t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	firstZero = s.find('0') + 1
	if firstZero == 0:
		print(1, n - 1, 2, n)
	elif firstZero > n // 2:
		print(1, firstZero, 1, firstZero - 1)
	else:
		print(firstZero + 1, n, firstZero, n)


import sys

def solve(n, s):
	mid_idx = n // 2
	flag = 0
	for i in range(mid_idx, n):
		if s[i] == '0':
			flag = 1
			(l1, l2) = (1, 1)
			(r1, r2) = (i - 1, i)
			break
	if flag == 1:
		print(l2, r2 + 1, l1, r1 + 1)
		return
	if s[mid_idx - 1] == '0':
		(l1, r1, l2, r2) = (mid_idx, n, mid_idx + 1, n)
		print(l2, r2, l1, r1)
		return
	else:
		(l1, r1, l2, r2) = (mid_idx, n - 1, mid_idx + 1, n)
		print(l2, r2, l1, r1)
		return
for t in range(int(sys.stdin.readline())):
	n = int(sys.stdin.readline())
	s = sys.stdin.readline()
	solve(n, s)


def solve(cnt, num):
	if '0' in num[:int(cnt / 2)]:
		print(num.index('0') + 1, cnt, num.index('0') + 2, cnt)
		return
	if '0' in num[int(cnt / 2):]:
		print(1, num.index('0', int(cnt / 2)) + 1, 1, num.index('0', int(cnt / 2)))
		return
	print(1, cnt - 1, 2, cnt)
for _ in range(int(input())):
	solve(int(input()), input())


for _ in range(int(input())):
	n = int(input())
	ring = input()
	if ring.count('0') == 0:
		print(1, n - 1, 2, n)
	else:
		x = ring.index('0')
		print(x + 1, n, x + 2, n) if x + 1 <= n // 2 else print(1, x + 1, 1, x)


import sys
for _ in range(int(sys.stdin.readline())):
	n = int(sys.stdin.readline())
	s = sys.stdin.readline()
	if s.count('0') == 0:
		print('1' + ' ' + str(n - 1) + ' ' + '2' + ' ' + str(n))
	else:
		ind = s.index('0')
		if ind + 1 <= n // 2:
			print(str(ind + 1) + ' ' + str(n) + ' ' + str(ind + 2) + ' ' + str(n))
		else:
			print('1' + ' ' + str(ind + 1) + ' ' + '1' + ' ' + str(ind))


import os
import sys
from io import BytesIO, IOBase
import math
from decimal import Decimal
from decimal import *
from collections import defaultdict, deque
import heapq
import bisect
from decimal import Decimal
getcontext().prec = 25
abcd = 'abcdefghijklmnopqrstuvwxyz'
ABCD = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
months = {1: 31, 2: 28, 3: 31, 4: 30, 5: 31, 6: 30, 7: 31, 8: 31, 9: 30, 10: 31, 11: 30, 12: 31}
MOD = 1000000007
BUFSIZE = 8192
from bisect import bisect_left, bisect_right

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')
for _ in range(int(input())):
	n = int(input())
	s = input()
	k = s.find('0')
	if k == -1:
		print(1, n - 1, 2, n)
	elif k < n // 2:
		print(k + 2, n, k + 1, n)
	else:
		print(1, k + 1, 1, k)


from collections import deque
import heapq
from math import sqrt
import operator
from operator import itemgetter
import sys
import copy
inf_var = 0
if inf_var == 1:
	inf = open('input.txt', 'r')
else:
	inf = sys.stdin
input = inf.readline

def read_one_int():
	return int(input().rstrip('\n'))

def read_one_float():
	return float(input().rstrip('\n'))

def read_list_of_ints():
	res = [int(val) for val in input().rstrip('\n').split(' ')]
	return res

def read_str():
	return input().rstrip()

def main():
	tests = read_one_int()
	for _ in range(tests):
		n = read_one_int()
		cur_str = read_str()
		res = []
		allowed_len = n // 2
		for i in range(n - 1, 0, -1):
			if i < allowed_len:
				break
			if cur_str[i - 1] == '1' and cur_str[i] == '0':
				res = [1, i + 1, 1, i]
				break
		if res:
			print(' '.join(map(str, res)))
			continue
		for i in range(n - 1):
			if n - i - 1 < allowed_len:
				break
			if cur_str[i] == '0':
				res = [i + 1, n, i + 2, n]
				break
		if res:
			print(' '.join(map(str, res)))
			continue
		res = [1, n // 2 * 2, 1, n // 2]
		print(' '.join(map(str, res)))
main()


import os, sys
from io import BytesIO, IOBase

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, 8192))
			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, 8192))
			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')

class dict(dict):

	def __missing__(self, key):
		return 0
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
inp = lambda dtype: [dtype(x) for x in input().split()]
inp_2d = lambda dtype, n: [dtype(input()) for _ in range(n)]
inp_2ds = lambda dtype, n: [inp(dtype) for _ in range(n)]
inp_enu = lambda dtype: [(i, x) for (i, x) in enumerate(inp(dtype))]
inp_enus = lambda dtype, n: [[i] + [inp(dtype)] for i in range(n)]
ceil1 = lambda a, b: (a + b - 1) // b
for _ in range(int(input())):
	(n, s) = (int(input()), input())
	(ix, md) = (-1, n // 2)
	for i in range(n - 1, -1, -1):
		if s[i] == '0':
			ix = i
			break
	ix += 1
	if ix == 0:
		print(1, n // 2, 2, n // 2 + 1)
	elif ix > n // 2:
		print(ix - md, ix, ix - md, ix - 1)
	else:
		print(ix, ix + md, ix + 1, ix + md)


from collections import Counter, defaultdict, deque
import os, sys
input = lambda : sys.stdin.buffer.readline().rstrip(b'\r\n')

def dbp(*args, **kwargs):
	print(*args, file=sys.stderr, **kwargs)
a_str = lambda : input().decode('ascii')
get_int_list = lambda : [int(x) for x in input().split()]
join_str = lambda l, ch=' ': ch.join((str(x) for x in l))

def do_thing():
	n = int(input())
	s = a_str()

	def slow_solve():
		mw = n // 2
		minsub = '9' * mw
		for i in range((n + 1) // 2 + 1):
			sub = s[i:i + n // 2]
			dbp(sub, int(sub, 2))
			minsub = min(sub, minsub)
		dbp('min:', minsub)
	zidx = s.find('0')
	if zidx == -1:
		return join_str((1, n // 2, 2, n // 2 + 1))
	elif zidx < n // 2:
		return join_str((zidx + 1, n, zidx + 2, n))
	else:
		return join_str((1, zidx + 1, 1, zidx))
maxcc = 1
maxcc = int(input())
for cc in range(maxcc):
	print(do_thing())


_ = 1
_ = int(input())
while _ > 0:
	_ -= 1
	n = int(input())
	s = input()
	flag = 0
	c = 0
	for x in range(n):
		if s[x] == '0':
			c += 1
		else:
			c = 0
		if c >= n // 2:
			print(x - c + 2, x + 1, 1, n)
			flag = 1
			break
	if flag:
		continue
	flag1 = 0
	for x in range(n // 2, n):
		if s[x] == '0':
			print(1, x + 1, 1, x)
			flag1 = 1
			break
	if flag1:
		continue
	if n % 2 == 0:
		if s[n // 2 - 1] == '0':
			print(n // 2, n, n // 2 + 1, n)
		else:
			print(n // 2, n - 1, n // 2 + 1, n)
	elif s[n // 2] == '0':
		print(n // 2 + 1, n, n // 2 + 2, n)
	else:
		print(n // 2 + 1, n - 1, n // 2 + 2, n)