This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are connected by a cable. The computers are indexed by integers from 1 to n. It's known that any two computers connected by cable directly or through other computersPolycarpus decided to find out the network's topology. A network topology is the way of describing the network configuration, the scheme that shows the location and the connections of network devices.Polycarpus knows three main network topologies: bus, ring and star. A bus is the topology that represents a shared cable with all computers connected with it. In the ring topology the cable connects each computer only with two other ones. A star is the topology where all computers of a network are connected to the single central node.Let's represent each of these network topologies as a connected non-directed graph. A bus is a connected graph that is the only path, that is, the graph where all nodes are connected with two other ones except for some two nodes that are the beginning and the end of the path. A ring is a connected graph, where all nodes are connected with two other ones. A star is a connected graph, where a single central node is singled out and connected with all other nodes. For clarifications, see the picture.    (1) — bus, (2) — ring, (3) — star You've got a connected non-directed graph that characterizes the computer network in Polycarpus' corporation. Help him find out, which topology type the given network is. If that is impossible to do, say that the network's topology is unknown.

The first line contains two space-separated integers n and m (4 ≤ n ≤ 105; 3 ≤ m ≤ 105) — the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≤ xi, yi ≤ n) — the numbers of nodes that are connected by the i-the edge. It is guaranteed that the given graph is connected. There is at most one edge between any two nodes. No edge connects a node with itself.

In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topology" (without the quotes).

bus topology
ring topology
star topology
unknown topology

<?

$num = explode(' ', trim(fgets(STDIN)));
for ($i = 0; $i < $num[1]; $i++) {
    $arr = explode(' ', trim(fgets(STDIN)));
    $res[$arr[0]][$arr[1]] = 1;
    $res[$arr[1]][$arr[0]] = 1;
}
$result = Array();
$tmp = 0;
foreach ($res as $a) {
    foreach ($a as $b) {
        $result[$tmp] += $b;
    }
    $tmp += 1;
}
function cOne($var){
return ($var == 1);
}
function cTwo($var){
return ($var == 2);
}
$tmp = array_unique($result);
sort($tmp);
if (count($tmp) == 1 && $tmp[0] == 2)
    echo 'ring topology
';
elseif (count ($tmp) == 2 && $tmp[0] == 1 && $tmp[1] == $num[0] - 1)
    echo 'star topology
';
elseif (count($tmp) == 2 && $tmp[0] == 1 && $tmp[1] == 2 && count(array_filter($result, "cOne")) == 2 && count(array_filter($result, "cTwo")) == $num[0]-2)
    echo 'bus topology
';
else
    echo 'unknown topology
';
?>

<?

list($n, $m) = explode(" ", fgets(STDIN));

$n = (int)$n;
$m = (int)$m;

$top_counts = array();
while($m--) {
    list($top1, $top2) = explode(" ", fgets(STDIN));

    $top_counts[(int)$top1]++;
    $top_counts[(int)$top2]++;
}

$one_cnt = 0;
$two_cnt = 0;
$many = 0;

foreach($top_counts as $top => $count) {
    if($count == 1)
        $one_cnt++;
    elseif($count == 2)
        $two_cnt++;
    else // граф связный, значит только больше
        $many++;
}

if($one_cnt == 2 && $many == 0)
    die("bus topology");

if($one_cnt == 0 && $many == 0)
    die("ring topology");

if($two_cnt == 0 && $many == 1)
    die("star topology");

die("unknown topology");

<?php

$fIn = fopen('php://stdin', 'r');
$n = preg_split('[ ]', fgets($fIn));
$m = intval($n[1]);
$n = intval($n[0]);

$numbers = array();
for ($i = 0; $i < $m; ++$i) {
    $str = preg_split('[ ]', fgets($fIn));
    for ($j = 0; $j < 2; ++$j) {
        $num = intval($str[$j]);
        if (isset($numbers[$num]))
            $numbers[$num]++;
        else
            $numbers[$num] = 1;
    }
}
#print_r($numbers);
$a = array_count_values($numbers);
asort($a);
#print_r($a);
#$av = array_values($a);
if (count($a) == 2 && $a[2] == $n - 2 && $a[1] == 2) {
    echo 'bus topology';
} elseif (count($a) == 1 && $a[2] == $n) {
    echo 'ring topology';
} elseif (count($a) == 2 && $a[1] == $n - 1 && $a[$n - 1] == 1) {
    echo 'star topology';
} else {
    echo 'unknown topology';
}
?>

<?php
$lines = explode("\n", str_replace("\r", "", file_get_contents("php://stdin")));
list($n, $m) = explode(" ", array_shift($lines));
$tree = [];
for ($i = 0; $i < $m; $i++) {
    list($x, $y) = explode(" ", $lines[$i]);
    if (!isset($tree[$x]))
        $tree[$x] = 0;
    if (!isset($tree[$y]))
        $tree[$y] = 0;
    $tree[$x]++;
    $tree[$y]++;
}

$counts = [];
foreach ($tree as $val) {
    if (!isset($counts[$val])) {
        $counts[$val] = 1;
        if (count($counts) > 2)
            die("unknown topology");
    } else {
        $counts[$val]++;
    }
}

if (count($counts) == 1 && !empty($counts[2]))
    die("ring topology");
if (count($counts) == 2 && $counts[1] == 2 && $counts[2] > 1)
    die("bus topology");
$keys = array_keys($counts);
sort($keys);
if ($keys[0] == 1 && $keys[1] == $n-1)
    die("star topology");
echo "unknown topology";

<?php

$fIn = fopen('php://stdin', 'r');
$n = preg_split('[ ]', fgets($fIn));
$m = intval($n[1]);
$n = intval($n[0]);

$numbers = array();
for ($i = 0; $i < $m; ++$i) {
    $str = preg_split('[ ]', fgets($fIn));
    for ($j = 0; $j < 2; ++$j) {
        $num = intval($str[$j]);
        if (isset($numbers[$num]))
            $numbers[$num]++;
        else
            $numbers[$num] = 1;
    }
}
#print_r($numbers);
$a = array_count_values($numbers);
sort($a);
#print_r($a);
if (count($a) == 2 && $a[0] == 2 && $a[1] == $n - 2) {
    echo 'bus topology';
} elseif (count($a) == 1 && $a[0] == $n) {
    echo 'ring topology';
} elseif (count($a) == 2 && $a[0] == 1 && $a[1] == $n - 1) {
    echo 'star topology';
} else {
    echo 'unknown topology';
}
?>

<?php

$fIn = fopen('php://stdin', 'r');
$n = preg_split('[ ]', fgets($fIn));
$m = intval($n[1]);
$n = intval($n[0]);

$numbers = array();
for ($i = 0; $i < $m; ++$i) {
    $str = preg_split('[ ]', fgets($fIn));
    for ($j = 0; $j < 2; ++$j) {
        $num = intval($str[$j]);
        if (isset($numbers[$num]))
            $numbers[$num]++;
        else
            $numbers[$num] = 1;
    }
}
$a = array_count_values($numbers);
sort($a);
if (count($a) == 2 && $a[0] == 2 && $a[1] == $n - 2) {
    echo 'bus topology';
} elseif (count($a) == 1) {
    echo 'ring topology';
} elseif (count($a) == 2 && $a[0] == 1 && $a[1] == $n - 1) {
    echo 'star topology';
} else {
    echo 'unknown topology';
}
?>

<?php

$fIn = fopen('php://stdin', 'r');
$n = preg_split('[ ]', fgets($fIn));
$m = intval($n[1]);
$n = intval($n[0]);

$numbers = array();
for ($i = 0; $i < $m; ++$i) {
    $str = preg_split('[ ]', fgets($fIn));
    for ($j = 0; $j < 2; ++$j) {
        $num = intval($str[$j]);
        if (isset($numbers[$num]))
            $numbers[$num]++;
        else
            $numbers[$num] = 1;
    }
}
$a = array_count_values($numbers);
sort($a);
if ($a[0] == 2 && $a[1] == $n - 2) {
    echo 'bus topology';
} elseif (count($a) == 1) {
    echo 'ring topology';
} elseif (count($a) == 2 && $a[0] == 1 && $a[1] == $n - 1) {
    echo 'star topology';
} else {
    echo 'unknown topology';
}
?>

<?php

$fIn = fopen('php://stdin', 'r');
$n = preg_split('[ ]', fgets($fIn));
$m = intval($n[1]);
$n = intval($n[0]);

$numbers = array();
for ($i = 0; $i < $m; ++$i) {
    $str = preg_split('[ ]', fgets($fIn));
    for ($j = 0; $j < 2; ++$j) {
        $num = intval($str[$j]);
        if (isset($numbers[$num]))
            $numbers[$num]++;
        else
            $numbers[$num] = 1;
    }
}
#print_r($numbers);
$a = array_count_values($numbers);
sort($a);
#print_r($a);
if (count($a) == 2 && $a[0] == 2 && $a[1] == $n - 2) {
    echo 'bus topology';
} elseif (count($a) == 1 && $a[0] == $n && in_array(2, $numbers)) {
    echo 'ring topology';
} elseif (count($a) == 2 && $a[0] == 1 && $a[1] == $n - 1) {
    echo 'star topology';
} else {
    echo 'unknown topology';
}
?>

<?php

$fIn = fopen('php://stdin', 'r');
$n = preg_split('[ ]', fgets($fIn));
$m = intval($n[1]);
$n = intval($n[0]);

$numbers = array();
for ($i = 0; $i < $m; ++$i) {
    $str = preg_split('[ ]', fgets($fIn));
    for ($j = 0; $j < 2; ++$j) {
        $num = intval($str[$j]);
        if (isset($numbers[$num]))
            $numbers[$num]++;
        else
            $numbers[$num] = 1;
    }
}
#print_r($numbers);
$a = array_count_values($numbers);
asort($a);
#print_r($a);
$av = array_values($a);
if (count($a) == 2 && $av[0] == 2 && $av[1] == $n - 2) {
    echo 'bus topology';
} elseif (count($a) == 1 && $a[2] == $n) {
    echo 'ring topology';
} elseif (count($a) == 2 && $av[0] == 1 && $av[1] == $n - 1) {
    echo 'star topology';
} else {
    echo 'unknown topology';
}
?>

<?php

$fIn = fopen('php://stdin', 'r');
$n = preg_split('[ ]', fgets($fIn));
$m = intval($n[1]);
$n = intval($n[0]);

$numbers = array();
for ($i = 0; $i < $m; ++$i) {
    $str = preg_split('[ ]', fgets($fIn));
    for ($j = 0; $j < 2; ++$j) {
        $num = intval($str[$j]);
        if (isset($numbers[$num]))
            $numbers[$num]++;
        else
            $numbers[$num] = 1;
    }
}
#print_r($numbers);
$a = array_count_values($numbers);
sort($a);
#print_r($a);
if (count($a) == 2 && $a[0] == 2 && $a[1] == $n - 2) {
    echo 'bus topology';
} elseif (count($a) == 1 && $a[0] == 2) {
    echo 'ring topology';
} elseif (count($a) == 2 && $a[0] == 1 && $a[1] == $n - 1) {
    echo 'star topology';
} else {
    echo 'unknown topology';
}
?>

<?php
$lines = explode("\n", str_replace("\r", "", file_get_contents("php://input")));
list($n, $m) = explode(" ", array_shift($lines));
$tree = [];
for ($i = 0; $i < $m; $i++) {
    list($x, $y) = explode(" ", $lines[$i]);
    if (!isset($tree[$x]))
        $tree[$x] = 0;
    if (!isset($tree[$y]))
        $tree[$y] = 0;
    $tree[$x]++;
    $tree[$y]++;
}

$counts = [];
foreach ($tree as $val) {
    if (!isset($counts[$val])) {
        $counts[$val] = 1;
        if (count($counts) > 2)
            die("unknown topology");
    } else {
        $counts[$val]++;
    }
}

if (count($counts) == 1 && !empty($counts[2]))
    die("ring topology");
if (count($counts) == 2 && $counts[1] == 2 && $counts[2] > 1)
    die("bus topology");
$keys = array_keys($counts);
sort($keys);
if ($keys[0] == 1 && $keys[1] == $n-1)
    die("star topology");
echo "unknown topology";

<?php
$lines = explode("\n", str_replace("\r", "", file_get_contents("php://input")));
list($n, $m) = explode(" ", array_shift($lines));
$tree = [];
for ($i = 0; $i < $m; $i++) {
    list($x, $y) = explode(" ", $lines[$i]);
    if (!isset($tree[$x]))
        $tree[$x] = 0;
    if (!isset($tree[$y]))
        $tree[$y] = 0;
    $tree[$x]++;
    $tree[$y]++;
}

$counts = [];
foreach ($tree as $val) {
    if (!isset($counts[$val])) {
        $counts[$val] = 1;
        if (count($counts) > 2)
            die("unknown topology");
    } else {
        $counts[$val]++;
    }
}

if (count($counts) == 1 && !empty($counts[2]))
    die("ring topology");
if (count($counts) == 2 && $counts[1] == 2 && $counts[2] > 1)
    die("bus topology");
$keys = array_keys($counts);
sort($keys);
if ($keys[0] == 1 && $keys[1] > 2)
    die("star topology");
echo "unknown topology";


The zombies are gathering in their secret lair! Heidi will strike hard to destroy them once and for all. But there is a little problem... Before she can strike, she needs to know where the lair is. And the intel she has is not very good.Heidi knows that the lair can be represented as a rectangle on a lattice, with sides parallel to the axes. Each vertex of the polygon occupies an integer point on the lattice. For each cell of the lattice, Heidi can check the level of Zombie Contamination. This level is an integer between 0 and 4, equal to the number of corners of the cell that are inside or on the border of the rectangle.As a test, Heidi wants to check that her Zombie Contamination level checker works. Given the output of the checker, Heidi wants to know whether it could have been produced by a single non-zero area rectangular-shaped lair (with axis-parallel sides).

The first line of each test case contains one integer N, the size of the lattice grid (5 ≤ N ≤ 50). The next N lines each contain N characters, describing the level of Zombie Contamination of each cell in the lattice. Every character of every line is a digit between 0 and 4. Cells are given in the same order as they are shown in the picture above: rows go in the decreasing value of y coordinate, and in one row cells go in the order of increasing x coordinate. This means that the first row corresponds to cells with coordinates (1, N), ..., (N, N) and the last row corresponds to cells with coordinates (1, 1), ..., (N, 1).

The first line of the output should contain Yes if there exists a single non-zero area rectangular lair with corners on the grid for which checking the levels of Zombie Contamination gives the results given in the input, and No otherwise.

NoteThe lair, if it exists, has to be rectangular (that is, have corners at some grid points with coordinates (x1, y1), (x1, y2), (x2, y1), (x2, y2)), has a non-zero area and be contained inside of the grid (that is, 0 ≤ x1 < x2 ≤ N, 0 ≤ y1 < y2 ≤ N), and result in the levels of Zombie Contamination as reported in the input.


Your favorite shop sells $$$n$$$ Kinder Surprise chocolate eggs. You know that exactly $$$s$$$ stickers and exactly $$$t$$$ toys are placed in $$$n$$$ eggs in total.Each Kinder Surprise can be one of three types:  it can contain a single sticker and no toy;  it can contain a single toy and no sticker;  it can contain both a single sticker and a single toy. But you don't know which type a particular Kinder Surprise has. All eggs look identical and indistinguishable from each other.What is the minimum number of Kinder Surprise Eggs you have to buy to be sure that, whichever types they are, you'll obtain at least one sticker and at least one toy?Note that you do not open the eggs in the purchasing process, that is, you just buy some number of eggs. It's guaranteed that the answer always exists.

The first line contains the single integer $$$T$$$ ($$$1 \le T \le 100$$$) — the number of queries. Next $$$T$$$ lines contain three integers $$$n$$$, $$$s$$$ and $$$t$$$ each ($$$1 \le n \le 10^9$$$, $$$1 \le s, t \le n$$$, $$$s + t \ge n$$$) — the number of eggs, stickers and toys. All queries are independent.

Print $$$T$$$ integers (one number per query) — the minimum number of Kinder Surprise Eggs you have to buy to be sure that, whichever types they are, you'll obtain at least one sticker and one toy

NoteIn the first query, we have to take at least $$$6$$$ eggs because there are $$$5$$$ eggs with only toy inside and, in the worst case, we'll buy all of them.In the second query, all eggs have both a sticker and a toy inside, that's why it's enough to buy only one egg.In the third query, we have to buy both eggs: one with a sticker and one with a toy.

<?php
$a = trim(fgets(STDIN));
for($x = 1; $x <= $a; $x++)
{
     list($b, $c, $d) = explode(" ", trim(fgets(STDIN)));
     print $b - min($c, $d) + 1 . "\n";
}
?>

<?php
#1187A
$n = (int)trim(fgets(STDIN));
while ($n--) {
    [$eggsCount, $toysCount, $stickersCount] = fscanf(STDIN, '%u %u %u');
    echo ($eggsCount - min($toysCount, $stickersCount) + 1) . PHP_EOL;
}


Winters are just damn freezing cold in Nvodsk! That's why a group of n friends prefers to take a taxi, order a pizza and call girls. The phone numbers in the city consist of three pairs of digits (for example, 12-34-56). Each friend has a phonebook of size si (that's the number of phone numbers). We know that taxi numbers consist of six identical digits (for example, 22-22-22), the numbers of pizza deliveries should necessarily be decreasing sequences of six different digits (for example, 98-73-21), all other numbers are the girls' numbers.You are given your friends' phone books. Calculate which friend is best to go to when you are interested in each of those things (who has maximal number of phone numbers of each type). If the phone book of one person contains some number two times, you should count it twice. That is, each number should be taken into consideration the number of times it occurs in the phone book.

The first line contains an integer n (1 ≤ n ≤ 100) — the number of friends.  Then follow n data blocks that describe each friend's phone books. Each block is presented in the following form: first goes the line that contains integer si and string namei (0 ≤ si ≤ 100) — the number of phone numbers in the phone book of the i-th friend and the name of the i-th friend. The name is a non-empty sequence of uppercase and lowercase Latin letters, containing no more than 20 characters. Next si lines contain numbers as "XX-XX-XX", where X is arbitrary digits from 0 to 9.

In the first line print the phrase "If you want to call a taxi, you should call: ". Then print names of all friends whose phone books contain maximal number of taxi phone numbers.  In the second line print the phrase "If you want to order a pizza, you should call: ". Then print names of all friends who have maximal number of pizza phone numbers.  In the third line print the phrase "If you want to go to a cafe with a wonderful girl, you should call: ". Then print names of all friends who have maximal number of girls' phone numbers.  Print the names in the order in which they are given in the input data. Separate two consecutive names with a comma and a space. Each line should end with exactly one point. For clarifications concerning the output form, see sample tests. It is necessary that you follow the output form strictly. Extra spaces are not allowed.

If you want to call a taxi, you should call: Rogulenko.
If you want to order a pizza, you should call: Fedorov, Rogulenko, Kaluzhin.
If you want to go to a cafe with a wonderful girl, you should call: Melnikov.

If you want to call a taxi, you should call: Gleb.
If you want to order a pizza, you should call: Gleb, Serega.
If you want to go to a cafe with a wonderful girl, you should call: Melnik.

If you want to call a taxi, you should call: Pachocki.
If you want to order a pizza, you should call: Kulczynski, Pachocki.
If you want to go to a cafe with a wonderful girl, you should call: Kulczynski.

NoteIn the first sample you are given four friends. Fedorov's phone book contains one taxi number and one pizza delivery number, Melnikov's phone book only has 3 numbers of girls, Rogulenko's one has 6 taxi numbers and one pizza delivery number, Kaluzhin's one contains 2 taxi numbers and one pizza delivery number.Thus, if you need to order a taxi, you should obviously call Rogulenko, if you need to order a pizza you should call anybody of the following: Rogulenko, Fedorov, Kaluzhin (each of them has one number). Melnikov has maximal number of phone numbers of girls.

<?php
function number_taxi($str){
/*$arr = explode("-", $str);
	for ($i = 0; $i < count($arr) - 1; $i++) {
		if ($arr[$i] !== $arr[$i + 1]) return false;
	}
*/
	$str = str_replace("-", "", $str);
	$arr = str_split($str);
	$temp = $arr[0];
	foreach ($arr as $as_i) {
		if ($temp !== $as_i) return false;
	}
	return true;
}

function number_pizza($str){
/*	$arr = explode("-", $str);
	$temp_c_arr = array();
	$temp_c = 0;
	//for ($i = 0; $i < count($arr) - 1; $i++) {
	for ($i = 0; $i < count($arr); $i++) {
		$temp_c_arr = str_split($arr[$i]);
		//if ($temp_c_arr[0] > $temp_c_arr[1]) return false;
		if ($temp_c_arr[0] < $temp_c_arr[1]) return false;
		else if ($temp_c_arr[0] === $temp_c_arr[1]) $temp_c++;
	}
	if ($temp_c === 3) return false;
*/
	$str = str_replace("-", "", $str);
	$arr = str_split($str);
	$temp = 10;
	foreach ($arr as $as_i) {
		if ($temp <= $as_i) return false;
		$temp = $as_i;
	}
	return true;
}
/*
function arr_make_names($arr) {
	$temp_arr = array();
	foreach ($arr as $as_i) {
		if (is_array($as_i) === true) {
			$temp_arr[] = get_array_message($as_i, ", ");
		} else {
			$temp_arr[] = $as_i;
		}
	}
	return $temp_arr;
}
*/

function change_counts_names(&$arr_c, &$arr_n, $c_t, $c_p, $c_g, $name){
	if ($arr_c[0] < $c_t) {
		$arr_c[0] = $c_t;
		$arr_n[0] = $name;
	} else if ($arr_c[0] === $c_t) {
		if ($arr_n[0] !== "") {
			//$arr_n[0] = $arr_n[0] . ", " . $name;
			$arr_n[0] .= ", " . $name;
		} else {
			$arr_n[0] = $name;
		}
	}
	if ($arr_c[1] < $c_p) {
		$arr_c[1] = $c_p;
		$arr_n[1] = $name;
	} else if ($arr_c[1] === $c_p) {
		if ($arr_n[1] !== "") {
			//$arr_n[1] = $arr_n[1] . ", " . $name;
			$arr_n[1] .= ", " . $name;
		} else {
			$arr_n[1] = $name;
		}
	}
	if ($arr_c[2] < $c_g) {
		$arr_c[2] = $c_g;
		$arr_n[2] = $name;
	//} else if ($arr_c[2] = $c_g) {
	} else if ($arr_c[2] === $c_g) {
		if ($arr_n[2] !== "") {
			//$arr_n[2] = "$arr_n[1], $name";
			//$arr_n[2] = $arr_n[2] . ", " . $name;
			$arr_n[2] .= ", " . $name;
		} else {
			$arr_n[2] = $name;
		}
	}
}

function print_names($arr){
	print("If you want to call a taxi, you should call: $arr[0].\n");
	print("If you want to order a pizza, you should call: $arr[1].\n");
	print("If you want to go to a cafe with a wonderful girl, you should call: $arr[2].");
}

function solve(){
	//$Token = new Token(rtrim(fgets(STDIN), "\n"), " ");
	$Token = new Token(rtrim(fgets(STDIN)), " ");
	$inp_n = $Token->nextInt();
	$ans_name_arr = array_fill(0, 3, "");
	$ans_count_arr = array_fill(0, 3, -1);
	for ($i = 0; $i < $inp_n; $i++) {
		//$Token = new Token(rtrim(fgets(STDIN), "\n"), " ");
		$Token = new Token(rtrim(fgets(STDIN)), " ");
		$inp_s = $Token->nextInt();
		//$inp_name = $Token->nextInt();
		$inp_name = $Token->nextToken();
		$temp_c_taxi = 0;
		$temp_c_pizza = 0;
		$temp_c_girl = 0;
		for ($j = 0; $j < $inp_s; $j++) {
			//$Token = new Token(rtrim(fgets(STDIN), "\n"), " ");
			$Token = new Token(rtrim(fgets(STDIN)), " ");
			$inp_number = $Token->nextToken();
			if (number_taxi($inp_number) === true) {
				$temp_c_taxi++;
			} else if (number_pizza($inp_number) === true) {
				$temp_c_pizza++;
			} else {
				$temp_c_girl++;
			}
		}
		change_counts_names($ans_count_arr, $ans_name_arr, $temp_c_taxi, $temp_c_pizza, $temp_c_girl, $inp_name);
	}
	print_names($ans_name_arr);
}

function run(){
	solve();
}

ob_end_clean();
run();

//input -  $inp_
//block    $temp_
//two block$ttemp_
//as 	   $as_
//instance $(Upper)
//ref      $ref
//class menba $_
//overwritten function $aa---_

class Token{
	private $token;
	private $tok;

	public function __construct($str_line, $tok) {
		$this->tok = $tok;
		$this->token = strtok($str_line, $this->tok);
	}

	public function nextToken() {
		$thisToken = $this->token;
		$this->token = strtok($this->tok);
		return $thisToken;
	}

	public function nextFloat() {
		return (float)$this->nextToken();
	}

  	public function nextInt() {
		return (int)$this->nextToken();
	}

	public function nextIntArray() {
		$temp_arr = array();
		$flag = -1;
		while ($flag !== 1) {
			$thisToken = $this->nextToken();
			if ($thisToken !== false) {
				$temp_arr[] = $thisToken;
			} else {
				$flag = 1;
			}
		}
		return $temp_arr;
	}

	public function nnextIntArray($num) {
		$temp_arr = array();
		for ($i = 0; $i < $num; $i++) {
			$temp_arr[] = (int)$this->token;
		}
		return $temp_arr;
	}
}

/*
function get_line() {
        $stdin = fopen("php://stdin", "r");
        $line = rtrim($stdin, "\n");
        fclose($stdin);
        return $line;
}
*/

function num_printf($i){
	if (is_float($i)) {
		printf("%.10f", $i);
	}
	if (is_int($i)) {
		printf("%10d", $i);
	}
}

function array_printf(array $array) {
		$message = "";
		foreach ($array as $value) {
			//$message .= "$value" . " ";
			$message .= $value . " ";
		}
		$message = rtrim($message);
		printf('%s', $message);
}

function aarray_printf(array $array, $str) {
		$message = "";
		foreach ($array as $value) {
			$message .= $value . $str;
		}
		$message = rtrim($message, $str);
		printf('%s', $message);
}
/*
function get_array_message(array $array, $str) {
		$message = "";
		foreach ($array as $value) {
			//$message .= "$value" . "$str";
			$message .= $value . $str;
		}
		$message = rtrim($message, $str);
		return $message;
}
*/
?>

<?php
function number_taxi($str){
/*$arr = explode("-", $str);
	for ($i = 0; $i < count($arr) - 1; $i++) {
		if ($arr[$i] !== $arr[$i + 1]) return false;
	}
*/
	$str = str_replace("-", "", $str);
	$arr = str_split($str);
	$temp = $arr[0];
	foreach ($arr as $as_i) {
		if ($temp !== $as_i) return false;
	}
	return true;
}

function number_pizza($str){
/*	$arr = explode("-", $str);
	$temp_c_arr = array();
	$temp_c = 0;
	//for ($i = 0; $i < count($arr) - 1; $i++) {
	for ($i = 0; $i < count($arr); $i++) {
		$temp_c_arr = str_split($arr[$i]);
		//if ($temp_c_arr[0] > $temp_c_arr[1]) return false;
		if ($temp_c_arr[0] < $temp_c_arr[1]) return false;
		else if ($temp_c_arr[0] === $temp_c_arr[1]) $temp_c++;
	}
	if ($temp_c === 3) return false;
*/
	$str = str_replace("-", "", $str);
	$arr = str_split($str);
	$temp = 10;
	foreach ($arr as $as_i) {
		if ($temp <= $as_i) return false;
		$temp = $as_i;
	}
	return true;
}
/*
function arr_make_names($arr) {
	$temp_arr = array();
	foreach ($arr as $as_i) {
		if (is_array($as_i) === true) {
			$temp_arr[] = get_array_message($as_i, ", ");
		} else {
			$temp_arr[] = $as_i;
		}
	}
	return $temp_arr;
}
*/
function change_count_name(&$arr_c_el, &$arr_n_el, $c, $name){
	if ($arr_c_el < $c) {
		$arr_c_el = $c;
		$arr_n_el = $name;
	} else if ($arr_c_el === $c) {
		if ($arr_n_el !== "") {
			//$arr_n[0] = $arr_n[0] . ", " . $name;
			$arr_n_el .= ", " . $name;
		} else {
			$arr_n_el = $name;
		}
	}
}

function change_counts_names(&$arr_c, &$arr_n, $c_t, $c_p, $c_g, $name){
	change_count_name($arr_c[0], $arr_n[0], $c_t, $name);
	change_count_name($arr_c[1], $arr_n[1], $c_p, $name);
	change_count_name($arr_c[2], $arr_n[2], $c_g, $name);
}

function print_names($arr){
	print("If you want to call a taxi, you should call: $arr[0].\n");
	print("If you want to order a pizza, you should call: $arr[1].\n");
	print("If you want to go to a cafe with a wonderful girl, you should call: $arr[2].");
}

function solve(){
	//$Token = new Token(rtrim(fgets(STDIN), "\n"), " ");
	$Token = new Token(rtrim(fgets(STDIN)), " ");
	$inp_n = $Token->nextInt();
	$ans_name_arr = array_fill(0, 3, "");
	$ans_count_arr = array_fill(0, 3, -1);
	for ($i = 0; $i < $inp_n; $i++) {
		//$Token = new Token(rtrim(fgets(STDIN), "\n"), " ");
		$Token = new Token(rtrim(fgets(STDIN)), " ");
		$inp_s = $Token->nextInt();
		//$inp_name = $Token->nextInt();
		$inp_name = $Token->nextToken();
		$temp_c_taxi = 0;
		$temp_c_pizza = 0;
		$temp_c_girl = 0;
		for ($j = 0; $j < $inp_s; $j++) {
			//$Token = new Token(rtrim(fgets(STDIN), "\n"), " ");
			$Token = new Token(rtrim(fgets(STDIN)), " ");
			$inp_number = $Token->nextToken();
			if (number_taxi($inp_number) === true) {
				$temp_c_taxi++;
			} else if (number_pizza($inp_number) === true) {
				$temp_c_pizza++;
			} else {
				$temp_c_girl++;
			}
		}
		change_counts_names($ans_count_arr, $ans_name_arr, $temp_c_taxi, $temp_c_pizza, $temp_c_girl, $inp_name);
	}
	print_names($ans_name_arr);
}

function run(){
	solve();
}

ob_end_clean();
run();

//input -  $inp_
//block    $temp_
//two block$ttemp_
//as 	   $as_
//instance $(Upper)
//ref      $ref
//class menba $_
//overwritten function $aa---_

class Token{
	private $token;
	private $tok;

	public function __construct($str_line, $tok) {
		$this->tok = $tok;
		$this->token = strtok($str_line, $this->tok);
	}

	public function nextToken() {
		$thisToken = $this->token;
		$this->token = strtok($this->tok);
		return $thisToken;
	}

	public function nextFloat() {
		return (float)$this->nextToken();
	}

  	public function nextInt() {
		return (int)$this->nextToken();
	}

	public function nextIntArray() {
		$temp_arr = array();
		$flag = -1;
		while ($flag !== 1) {
			$thisToken = $this->nextToken();
			if ($thisToken !== false) {
				$temp_arr[] = $thisToken;
			} else {
				$flag = 1;
			}
		}
		return $temp_arr;
	}

	public function nnextIntArray($num) {
		$temp_arr = array();
		for ($i = 0; $i < $num; $i++) {
			$temp_arr[] = (int)$this->token;
		}
		return $temp_arr;
	}
}

/*
function get_line() {
        $stdin = fopen("php://stdin", "r");
        $line = rtrim($stdin, "\n");
        fclose($stdin);
        return $line;
}
*/

function num_printf($i){
	if (is_float($i)) {
		printf("%.10f", $i);
	}
	if (is_int($i)) {
		printf("%10d", $i);
	}
}

function array_printf(array $array) {
		$message = "";
		foreach ($array as $value) {
			//$message .= "$value" . " ";
			$message .= $value . " ";
		}
		$message = rtrim($message);
		printf('%s', $message);
}

function aarray_printf(array $array, $str) {
		$message = "";
		foreach ($array as $value) {
			$message .= $value . $str;
		}
		$message = rtrim($message, $str);
		printf('%s', $message);
}
/*
function get_array_message(array $array, $str) {
		$message = "";
		foreach ($array as $value) {
			//$message .= "$value" . "$str";
			$message .= $value . $str;
		}
		$message = rtrim($message, $str);
		return $message;
}
*/
?>

<?php
error_reporting(0);
/* Class For Read Input - laurenceHR
*/
class stdIn{
    var $ntxt = 0;
    var $nline = 0;
    var $arr_txt;
    var $arr_line;
    var $linex;
    var $liney;
    function stdIn($local = false){
        if($local){
            $dir = fopen("input.txt", 'r');
        }else{
            $dir = fopen("php://stdin", 'r');
        }
        $datatxt = stream_get_contents($dir);
        $del = Array("\n","\r","\n\r");
        $data = explode("\n",$datatxt);
        $il = 0;$id = 0;//
        foreach($data as $line){
            if(strlen($line) > 0){
                $line = str_replace($del,'',$line);
                $dataex[] = $line;
                $text = explode(" ",$line);
                foreach($text as $txt){
                    $arr_txt[] = $txt;
                    $this->linex[$id] = $il;
                    $this->liney[$il] = $id;
                    $id++;//
                }
            }
        $il++;//
        }
        $this->arr_line = $dataex;
        $this->arr_txt  = $arr_txt;
    }
    function G(){// Get Last Txt
        $ret = $this->arr_txt[$this->ntxt++];
        $this->nline = $this->linex[$this->ntxt];
        return $ret;
    }
    function GL(){ //Get Last Line
        $this->ntxt = $this->liney[$this->nline]+1;
        return $this->arr_line[$this->nline++];
    }
}
$dxs = new stdIn(false);
//define("I",$dxs);
//define("STL",$dxs->GL());
//////////////////////////////////////////////////////////////

//echo ":".print_r($inp->lineal,true).":";
function typeN($nums){
    $number = explode("-",$nums);
    $dig11 = (int)($number[0]/10);$dig12 = (int)($number[0]%10);
    $dig21 = (int)($number[1]/10);$dig22 = (int)($number[1]%10);
    $dig31 = (int)($number[2]/10);$dig32 = (int)($number[2]%10);
    if($dig11>$dig12 && $dig12>$dig21 && $dig21>$dig22 && $dig22>$dig31 && $dig31>$dig32){return 'pizza';}
    else if($dig11 == $dig12 && $dig12 == $dig21 && $dig21 == $dig22 && $dig22 == $dig31 && $dig31 == $dig32){return 'taxi';}
    else{return 'girl';}
}
function joinA($c,$txt){$i=0;$ret = "";
    foreach($txt as $it){if($i>0){$ret .= $c." ";}
    $ret .= $it;$i++;}
    return $ret;
}
$max['taxi']=0;$max['pizza']=0;$max['girl']=0;
$n = $dxs->G();
for($i=0;$i<$n;$i++){
    $nums = $dxs->G();
    $name = $dxs->G();
    $total[$name]['taxi']=0;$total[$name]['pizza']=0;$total[$name]['girl']=0;
    for($j=0;$j<$nums;$j++){
        $telf = $dxs->G();$typ = typeN($telf);
        $nt = ++$total[$name][$typ];
        if($max[$typ]<$nt){$max[$typ]=$nt;}
    }
}
//print_r($total);
//print_r($max);
foreach($total as $name => $nmrs){
    foreach($nmrs as $type => $val){
        if($val == $max[$type]){$ret[$type][] = $name;}
    }
}
echo "If you want to call a taxi, you should call: ".joinA(",",$ret['taxi']).".\n";
echo "If you want to order a pizza, you should call: ".joinA(",",$ret['pizza']).".\n";
echo "If you want to go to a cafe with a wonderful girl, you should call: ".joinA(",",$ret['girl']).".";

?>

<?php
error_reporting(0);

function joinA($c,$txt){
    $i=0;$ret = "";
    foreach($txt as $it){
        if($i>0){$ret .= $c." ";}
        $del = Array("\n","\r","\n\r");
        $ret .= str_replace($del,'',$it);
        $i++;
    }
    return $ret;
}
$dir = fopen("php://stdin", 'r');
//$dir = fopen("input.txt", 'r');
$input = stream_get_contents($dir);
//print_r($input);
$intxt=explode("\n",$input);
$n = $intxt[0];
$max['taxi'] = 0;
$max['pizza'] = 0;
$max['girl'] = 0;
for($nl=1;$nl<count($intxt);$nl){// echo "<".$intxt[$nl]."
";

    // Depura Linea //
    $del = Array("\n","\r","\n\r");
    $intxtln = str_replace($del,'',$intxt[$nl]);//echo "<".$intxtn."
";
    if(strlen($intxtln) == 0){break;}
    //

    $lne = explode(" ",$intxtln);$nl++;

    $t = $lne[0]; //echo $t."
";
    $name = $lne[1];//echo $name."
";
    $total[$name]['taxi'] = 0;
    $total[$name]['pizza'] = 0;
    $total[$name]['girl'] = 0;
    for($j=1;$j<=$t;$j++){ //echo "->".$intxt[$nl]."
";

        $number = explode("-",$intxt[$nl]);$nl++;
        $num1 = (int)$number[0];$dig11 = (int)($num1/10);$dig12 = (int)($num1%10);
        $num2 = (int)$number[1];$dig21 = (int)($num2/10);$dig22 = (int)($num2%10);
        $num3 = (int)$number[2];$dig31 = (int)($num3/10);$dig32 = (int)($num3%10);

        if($dig11>$dig12 && $dig12>$dig21 && $dig21>$dig22 && $dig22>$dig31 && $dig31>$dig32){
            $mpizza = @++$total[$name]['pizza'];
            if(@$max['pizza']<$mpizza){$max['pizza'] = $mpizza;}
        }else if($dig11 == $dig12 && $dig12 == $dig21 && $dig21 == $dig22 && $dig22 == $dig31 && $dig31 == $dig32){
            $mtaxi = @++$total[$name]['taxi'];
            if(@$max['taxi']<$mtaxi){$max['taxi'] = $mtaxi;}
        }else{
            $mgirl =@++$total[$name]['girl'];
            if(@$max['girl']<$mgirl){$max['girl'] = $mgirl;}
        }

    }
}
//print_r($total);
foreach($total as $name => $tot){
    foreach($tot as $type => $val){
        if($val == $max[$type]){$ret[$type][] = $name;}
    }
}
//echo "\n";
//print_r($ret);
//solution
echo "If you want to call a taxi, you should call: ".joinA(",",$ret['taxi']).".\n";
echo "If you want to order a pizza, you should call: ".joinA(",",$ret['pizza']).".\n";
echo "If you want to go to a cafe with a wonderful girl, you should call: ".joinA(",",$ret['girl']).".";
?>

<?php
function number_taxi($str){
/*$arr = explode("-", $str);
	for ($i = 0; $i < count($arr) - 1; $i++) {
		if ($arr[$i] !== $arr[$i + 1]) return false;
	}
*/
	$str = str_replace("-", "", $str);
	$arr = str_split($str);
	$temp = $arr[0];
	foreach ($arr as $as_i) {
		if ($temp !== $as_i) return false;
	}
	return true;
}

function number_pizza($str){
/*	$arr = explode("-", $str);
	$temp_c_arr = array();
	$temp_c = 0;
	//for ($i = 0; $i < count($arr) - 1; $i++) {
	for ($i = 0; $i < count($arr); $i++) {
		$temp_c_arr = str_split($arr[$i]);
		//if ($temp_c_arr[0] > $temp_c_arr[1]) return false;
		if ($temp_c_arr[0] < $temp_c_arr[1]) return false;
		else if ($temp_c_arr[0] === $temp_c_arr[1]) $temp_c++;
	}
	if ($temp_c === 3) return false;
*/
	$str = str_replace("-", "", $str);
	$arr = str_split($str);
	$temp = 10;
	foreach ($arr as $as_i) {
		if ($temp <= $as_i) return false;
		$temp = $as_i;
	}
	return true;
}
/*
function arr_make_names($arr) {
	$temp_arr = array();
	foreach ($arr as $as_i) {
		if (is_array($as_i) === true) {
			$temp_arr[] = get_array_message($as_i, ", ");
		} else {
			$temp_arr[] = $as_i;
		}
	}
	return $temp_arr;
}
*/

function change_counts_names(&$arr_c, &$arr_n, $c_t, $c_p, $c_g, $name){
	if ($arr_c[0] < $c_t) {
		$arr_c[0] = $c_t;
		$arr_n[0] = $name;
	} else if ($arr_c[0] === $c_t) {
		if ($arr_n[0] !== "") {
			//$arr_n[0] = $arr_n[0] . ", " . $name;
			$arr_n[0] .= ", " . $name;
		} else {
			$arr_n[0] = $name;
		}
	}
	if ($arr_c[1] < $c_p) {
		$arr_c[1] = $c_p;
		$arr_n[1] = $name;
	} else if ($arr_c[1] === $c_p) {
		if ($arr_n[1] !== "") {
			//$arr_n[1] = $arr_n[1] . ", " . $name;
			$arr_n[1] .= ", " . $name;
		} else {
			$arr_n[1] = $name;
		}
	}
	if ($arr_c[2] < $c_g) {
		$arr_c[2] = $c_g;
		$arr_n[2] = $name;
	//} else if ($arr_c[2] = $c_g) {
	} else if ($arr_c[2] === $c_g) {
		if ($arr_n[2] !== "") {
			//$arr_n[2] = "$arr_n[1], $name";
			//$arr_n[2] = $arr_n[2] . ", " . $name;
			$arr_n[2] .= ", " . $name;
		} else {
			$arr_n[2] = $name;
		}
	}
}

function print_names($arr){
	print("If you want to call a taxi, you should call: $arr[0]\n");
	print("If you want to order a pizza, you should call: $arr[1]\n");
	print("If you want to go to a cafe with a wonderful girl, you should call: $arr[2]");
}

function solve(){
	//$Token = new Token(rtrim(fgets(STDIN), "\n"), " ");
	$Token = new Token(rtrim(fgets(STDIN)), " ");
	$inp_n = $Token->nextInt();
	$ans_name_arr = array_fill(0, 3, "");
	$ans_count_arr = array_fill(0, 3, -1);
	for ($i = 0; $i < $inp_n; $i++) {
		//$Token = new Token(rtrim(fgets(STDIN), "\n"), " ");
		$Token = new Token(rtrim(fgets(STDIN)), " ");
		$inp_s = $Token->nextInt();
		//$inp_name = $Token->nextInt();
		$inp_name = $Token->nextToken();
		$temp_c_taxi = 0;
		$temp_c_pizza = 0;
		$temp_c_girl = 0;
		for ($j = 0; $j < $inp_s; $j++) {
			//$Token = new Token(rtrim(fgets(STDIN), "\n"), " ");
			$Token = new Token(rtrim(fgets(STDIN)), " ");
			$inp_number = $Token->nextToken();
			if (number_taxi($inp_number) === true) {
				$temp_c_taxi++;
			} else if (number_pizza($inp_number) === true) {
				$temp_c_pizza++;
			} else {
				$temp_c_girl++;
			}
		}
		change_counts_names($ans_count_arr, $ans_name_arr, $temp_c_taxi, $temp_c_pizza, $temp_c_girl, $inp_name);
	}
	print_names($ans_name_arr);
}

function run(){
	solve();
}

ob_end_clean();
run();

//input -  $inp_
//block    $temp_
//two block$ttemp_
//as 	   $as_
//instance $(Upper)
//ref      $ref
//class menba $_
//overwritten function $aa---_

class Token{
	private $token;
	private $tok;

	public function __construct($str_line, $tok) {
		$this->tok = $tok;
		$this->token = strtok($str_line, $this->tok);
	}

	public function nextToken() {
		$thisToken = $this->token;
		$this->token = strtok($this->tok);
		return $thisToken;
	}

	public function nextFloat() {
		return (float)$this->nextToken();
	}

  	public function nextInt() {
		return (int)$this->nextToken();
	}

	public function nextIntArray() {
		$temp_arr = array();
		$flag = -1;
		while ($flag !== 1) {
			$thisToken = $this->nextToken();
			if ($thisToken !== false) {
				$temp_arr[] = $thisToken;
			} else {
				$flag = 1;
			}
		}
		return $temp_arr;
	}

	public function nnextIntArray($num) {
		$temp_arr = array();
		for ($i = 0; $i < $num; $i++) {
			$temp_arr[] = (int)$this->token;
		}
		return $temp_arr;
	}
}

/*
function get_line() {
        $stdin = fopen("php://stdin", "r");
        $line = rtrim($stdin, "\n");
        fclose($stdin);
        return $line;
}
*/

function num_printf($i){
	if (is_float($i)) {
		printf("%.10f", $i);
	}
	if (is_int($i)) {
		printf("%10d", $i);
	}
}

function array_printf(array $array) {
		$message = "";
		foreach ($array as $value) {
			//$message .= "$value" . " ";
			$message .= $value . " ";
		}
		$message = rtrim($message);
		printf('%s', $message);
}

function aarray_printf(array $array, $str) {
		$message = "";
		foreach ($array as $value) {
			$message .= $value . $str;
		}
		$message = rtrim($message, $str);
		printf('%s', $message);
}
/*
function get_array_message(array $array, $str) {
		$message = "";
		foreach ($array as $value) {
			//$message .= "$value" . "$str";
			$message .= $value . $str;
		}
		$message = rtrim($message, $str);
		return $message;
}
*/
?>

<?php
error_reporting(0);
function joinA($c,$txt){
	$i=0;$ret = "";
	foreach($txt as $it){
		if($i>0){$ret .= $c." ";}
		$del = Array("\n","\r","\n\r");
		$ret .= str_replace($del,'',$it);
		$i++;
	}
	return $ret;
}
$dir = fopen("php://stdin", 'r');
//$dir = fopen("input.txt", 'r');
$input = stream_get_contents($dir);
//print_r($input);
$intxt=explode("\n",$input);
$n = $intxt[0];
$max['taxi'] = 0;
$max['pizza'] = 0;
$max['girl'] = 0;
for($nl=1;$nl<count($intxt);$nl){// echo "<".$intxt[$nl]."
";

	// Depura Linea //
	$del = Array("\n","\r","\n\r");
	$intxtln = str_replace($del,'',$intxt[$nl]);//echo "<".$intxtn."
";
	if(strlen($intxtln) == 0){break;}
	//

	$lne = explode(" ",$intxtln);$nl++;

	$t = $lne[0]; //echo $t."
";
	$name = $lne[1];//echo $name."
";
	$total[$name]['taxi'] = 0;
	$total[$name]['pizza'] = 0;
	$total[$name]['girl'] = 0;
	for($j=1;$j<=$t;$j++){ //echo "->".$intxt[$nl]."
";

		$number = explode("-",$intxt[$nl]);$nl++;
		$num1 = $number[0];
		$num2 = $number[1];
		$num3 = $number[2];

		if($num1+$num2+$num3 == 3*$num1){
			$mtaxi = @++$total[$name]['taxi'];
			if(@$max['taxi']<$mtaxi){$max['taxi'] = $mtaxi;}
		}else if($num1/10>$num1%10 && $num1%10>$num2/10 && $num2/10>$num2%10 && $num2%10>$num3/10  &&  $num3/10>$num3%10){
			$mpizza = @++$total[$name]['pizza'];
			if(@$max['pizza']<$mpizza){$max['pizza'] = $mpizza;}
		}else{
			$mgirl =@++$total[$name]['girl'];
			if(@$max['girl']<$mgirl){$max['girl'] = $mgirl;}
		}

	}
}
//print_r($total);
foreach($total as $name => $tot){
	foreach($tot as $type => $val){
		if($val == $max[$type]){$ret[$type][] = $name;}
	}
}
//echo "\n";
//print_r($ret);
//solution
echo "If you want to call a taxi, you should call: ".joinA(",",$ret['taxi']).".\n";
echo "If you want to order a pizza, you should call: ".joinA(",",$ret['pizza']).".\n";
echo "If you want to go to a cafe with a wonderful girl, you should call: ".joinA(",",$ret['girl']).".";
?>

<?php
function joinA($c,$txt){
	$i=0;$ret = "";
	foreach($txt as $it){
		if($i>0){$ret .= $c." ";}
		$del = Array("\n","\r","\n\r");
		$ret .= str_replace($del,'',$it);
		$i++;
	}
	return $ret;
}
$dir = fopen("php://stdin", 'r');
//$dir = fopen("input.txt", 'r');
$input = stream_get_contents($dir);
//print_r($input);
$intxt=explode("\n",$input);
$n = $intxt[0];
for($nl=1;$nl<count($intxt);$nl){// echo "<".$intxt[$nl]."
";
	$lne = explode(" ",$intxt[$nl]);$nl++;
	$t = $lne[0]; //echo $t."
";
	$name = $lne[1];//echo $name."
";
	for($j=1;$j<=$t;$j++){ //echo "->".$intxt[$nl]."
";
		$number = explode("-",$intxt[$nl]);$nl++;
		$num1 = $number[0];
		$num2 = $number[1];
		$num3 = $number[2];

		if($num1+$num2+$num3 == 3*$num1){
			$mtaxi = @++$total[$name]['taxi'];
			if(@$max['taxi']<$mtaxi){$max['taxi'] = $mtaxi;}
		}else if($num1/10>$num1%10 && $num1%10>$num2/10 && $num2/10>$num2%10 && $num2%10>$num3/10  &&  $num3/10>$num3%10){
			$mpizza = @++$total[$name]['pizza'];
			if(@$max['pizza']<$mpizza){$max['pizza'] = $mpizza;}
		}else{
			$mgirl =@++$total[$name]['girl'];
			if(@$max['girl']<$mgirl){$max['girl'] = $mgirl;}
		}
	}
}
//print_r($total);
foreach($total as $name => $tot){
	foreach($tot as $type => $val){
		if($val == $max[$type]){ $ret[$type][] = $name;}
	}
}
//echo "\n";
//print_r($ret);
//solution
echo "If you want to call a taxi, you should call: ".joinA(",",$ret['taxi']).".\n";
echo "If you want to order a pizza, you should call: ".joinA(",",$ret['pizza']).".\n";
echo "If you want to go to a cafe with a wonderful girl, you should call: ".joinA(",",$ret['girl']).".";
?>

<?php

$dir = fopen("php://stdin", 'r');
//$dir = fopen("input.txt", 'r');
$input = stream_get_contents($dir);
//print_r($input);
$intxt=explode("\n",$input);
$n = $intxt[0];
for($nl=1;$nl<count($intxt);$nl){// echo "<".$intxt[$nl]."
";
	$lne = explode(" ",$intxt[$nl]);$nl++;
	$t = $lne[0]; //echo $t."
";
	$name = $lne[1];//echo $name."
";
	for($j=1;$j<=$t;$j++){ //echo "->".$intxt[$nl]."
";
		$number = explode("-",$intxt[$nl]);$nl++;
		$num1 = $number[0];
		$num2 = $number[1];
		$num3 = $number[2];

		if($num1+$num2+$num3 == 3*$num1){
			$mtaxi = @++$total[$name]['taxi'];
			if(@$max['taxi']<$mtaxi){$max['taxi'] = $mtaxi;}
		}else if($num1 > $num2 && $num2 > $num3){
			$mpizza = @++$total[$name]['pizza'];
			if(@$max['pizza']<$mpizza){$max['pizza'] = $mpizza;}
		}else{
			$mgirl =@++$total[$name]['girl'];
			if(@$max['girl']<$mgirl){$max['girl'] = $mgirl;}
		}
	}
}
//print_r($total);
foreach($total as $name => $tot){
	foreach($tot as $type => $val){
		if($val == $max[$type]){ $ret[$type][] = $name;}
	}
}
//print_r($ret);
//solution
echo "If you want to call a taxi, you should call: ".implode(",",$ret['taxi']).".\n";
echo "If you want to order a pizza, you should call: ".implode(",",$ret['pizza']).".\n";
echo "If you want to go to a cafe with a wonderful girl, you should call: ".implode(",",$ret['girl']).".\n";
?>

<?php
error_reporting(0);
function joinA($c,$txt){
	$i=0;$ret = "";
	foreach($txt as $it){
		if($i>0){$ret .= $c." ";}
		$del = Array("\n","\r","\n\r");
		$ret .= str_replace($del,'',$it);
		$i++;
	}
	return $ret;
}
//$dir = fopen("php://stdin", 'r');
$dir = fopen("input.txt", 'r');
$input = stream_get_contents($dir);
//print_r($input);
$intxt=explode("\n",$input);
$n = $intxt[0];
for($nl=1;$nl<count($intxt);$nl){// echo "<".$intxt[$nl]."
";
	$lne = explode(" ",$intxt[$nl]);$nl++;
	$t = $lne[0]; //echo $t."
";
	$name = $lne[1];//echo $name."
";
	for($j=1;$j<=$t;$j++){ echo "->".$intxt[$nl]."
";

		$number = explode("-",$intxt[$nl]);$nl++;
		$num1 = $number[0];
		$num2 = $number[1];
		$num3 = $number[2];

		if($num1+$num2+$num3 == 3*$num1){
			$mtaxi = @++$total[$name]['taxi'];
			if(@$max['taxi']<$mtaxi){$max['taxi'] = $mtaxi;}
		}else if($num1/10>$num1%10 && $num1%10>$num2/10 && $num2/10>$num2%10 && $num2%10>$num3/10  &&  $num3/10>$num3%10){
			$mpizza = @++$total[$name]['pizza'];
			if(@$max['pizza']<$mpizza){$max['pizza'] = $mpizza;}
		}else{
			$mgirl =@++$total[$name]['girl'];
			if(@$max['girl']<$mgirl){$max['girl'] = $mgirl;}
		}

	}
	//if($t==0){$nl++;}
}
//print_r($total);
foreach($total as $name => $tot){
	foreach($tot as $type => $val){
		if($val == $max[$type]){$ret[$type][] = $name;}
	}
}
//echo "\n";
//print_r($ret);
//solution
echo "If you want to call a taxi, you should call: ".joinA(",",$ret['taxi']).".\n";
echo "If you want to order a pizza, you should call: ".joinA(",",$ret['pizza']).".\n";
echo "If you want to go to a cafe with a wonderful girl, you should call: ".joinA(",",$ret['girl']).".";
?>

<?php
error_reporting(0);
function joinA($c,$txt){
	$i=0;$ret = "";
	foreach($txt as $it){
		if($i>0){$ret .= $c." ";}
		$del = Array("\n","\r","\n\r");
		$ret .= str_replace($del,'',$it);
		$i++;
	}
	return $ret;
}
$dir = fopen("php://stdin", 'r');
//$dir = fopen("input.txt", 'r');
$input = stream_get_contents($dir);
//print_r($input);
$intxt=explode("\n",$input);
$n = $intxt[0];
for($nl=1;$nl<count($intxt);$nl){ //echo "<".$intxt[$nl]."
";
	$lne = explode(" ",$intxt[$nl]);$nl++;
	$t = $lne[0]; //echo $t."
";
	$name = $lne[1];//echo $name."
";
	for($j=1;$j<=$t;$j++){ //echo "->".$intxt[$nl]."
";

		$number = explode("-",$intxt[$nl]);$nl++;
		$num1 = $number[0];
		$num2 = $number[1];
		$num3 = $number[2];

		if($num1+$num2+$num3 == 3*$num1){
			$mtaxi = @++$total[$name]['taxi'];
			if(@$max['taxi']<$mtaxi){$max['taxi'] = $mtaxi;}
		}else if($num1/10>$num1%10 && $num1%10>$num2/10 && $num2/10>$num2%10 && $num2%10>$num3/10  &&  $num3/10>$num3%10){
			$mpizza = @++$total[$name]['pizza'];
			if(@$max['pizza']<$mpizza){$max['pizza'] = $mpizza;}
		}else{
			$mgirl =@++$total[$name]['girl'];
			if(@$max['girl']<$mgirl){$max['girl'] = $mgirl;}
		}

	}
	//if($t==0){$nl++;}
}
//print_r($total);
foreach($total as $name => $tot){
	foreach($tot as $type => $val){
		if($val == $max[$type]){$ret[$type][] = $name;}
	}
}
//echo "\n";
//print_r($ret);
//solution
echo "If you want to call a taxi, you should call: ".joinA(",",$ret['taxi']).".\n";
echo "If you want to order a pizza, you should call: ".joinA(",",$ret['pizza']).".\n";
echo "If you want to go to a cafe with a wonderful girl, you should call: ".joinA(",",$ret['girl']).".";
?>

<?php
error_reporting(0);
function joinA($c,$txt){
	$i=0;$ret = "";
	foreach($txt as $it){
		if($i>0){$ret .= $c." ";}
		$del = Array("\n","\r","\n\r");
		$ret .= str_replace($del,'',$it);
		$i++;
	}
	return $ret;
}
$dir = fopen("php://stdin", 'r');
//$dir = fopen("input.txt", 'r');
$input = stream_get_contents($dir);
//print_r($input);
$intxt=explode("\n",$input);
$n = $intxt[0];
for($nl=1;$nl<count($intxt);$nl){ //echo "<".$intxt[$nl]."
";
	$lne = explode(" ",$intxt[$nl]);$nl++;
	$t = $lne[0]; //echo $t."
";
	$name = $lne[1];//echo $name."
";
	for($j=1;$j<=$t;$j++){ //echo "->".$intxt[$nl]."
";

		$number = explode("-",$intxt[$nl]);$nl++;
		$num1 = $number[0];
		$num2 = $number[1];
		$num3 = $number[2];

		if($num1+$num2+$num3 == 3*$num1){
			$mtaxi = @++$total[$name]['taxi'];
			if(@$max['taxi']<$mtaxi){$max['taxi'] = $mtaxi;}
		}else if($num1/10>$num1%10 && $num1%10>$num2/10 && $num2/10>$num2%10 && $num2%10>$num3/10  &&  $num3/10>$num3%10){
			$mpizza = @++$total[$name]['pizza'];
			if(@$max['pizza']<$mpizza){$max['pizza'] = $mpizza;}
		}else{
			$mgirl =@++$total[$name]['girl'];
			if(@$max['girl']<$mgirl){$max['girl'] = $mgirl;}
		}

	}
	if($t==0){
		@$total[$name]['taxi'] = 0;
		@$total[$name]['pizza'] = 0;
		@$total[$name]['girl'] = 0;
	}
}
//print_r($total);
foreach($total as $name => $tot){
	foreach($tot as $type => $val){
		if($val == $max[$type]){$ret[$type][] = $name;}
	}
}
//echo "\n";
//print_r($ret);
//solution
echo "If you want to call a taxi, you should call: ".joinA(",",$ret['taxi']).".\n";
echo "If you want to order a pizza, you should call: ".joinA(",",$ret['pizza']).".\n";
echo "If you want to go to a cafe with a wonderful girl, you should call: ".joinA(",",$ret['girl']).".";
?>

<?php
function joinA($c,$txt){
    $i=0;$ret = "";
    foreach($txt as $it){
        if($i>0){$ret .= $c." ";}
        $del = Array("\n","\r","\n\r");
        $ret .= str_replace($del,'',$it);
        $i++;
    }
    return $ret;
}
$dir = fopen("php://stdin", 'r');
//$dir = fopen("input.txt", 'r');
$input = stream_get_contents($dir);
//print_r($input);
$intxt=explode("\n",$input);
$n = $intxt[0];
for($nl=1;$nl<count($intxt);$nl){// echo "<".$intxt[$nl]."
";
    $lne = explode(" ",$intxt[$nl]);$nl++;
    $t = $lne[0]; //echo $t."
";
    $name = $lne[1];//echo $name."
";
    for($j=1;$j<=$t;$j++){ //echo "->".$intxt[$nl]."
";
        $number = explode("-",$intxt[$nl]);$nl++;
        $num1 = $number[0];
        $num2 = $number[1];
        $num3 = $number[2];

        if($num1+$num2+$num3 == 3*$num1){
            $mtaxi = @++$total[$name]['taxi'];
            if(@$max['taxi']<$mtaxi){$max['taxi'] = $mtaxi;}
        }else if($num1 > $num2 && $num2 > $num3){
            $mpizza = @++$total[$name]['pizza'];
            if(@$max['pizza']<$mpizza){$max['pizza'] = $mpizza;}
        }else{
            $mgirl =@++$total[$name]['girl'];
            if(@$max['girl']<$mgirl){$max['girl'] = $mgirl;}
        }
    }
}
//print_r($total);
foreach($total as $name => $tot){
    foreach($tot as $type => $val){
        if($val == $max[$type]){ $ret[$type][] = $name;}
    }
}
//print_r($ret);
//solution
echo "If you want to call a taxi, you should call: ".joinA(",",$ret['taxi']).".\n";
echo "If you want to order a pizza, you should call: ".joinA(",",$ret['pizza']).".\n";
echo "If you want to go to a cafe with a wonderful girl, you should call: ".joinA(",",$ret['girl']).".\n";
?>

<?php
error_reporting(0);
function joinA($c,$txt){
	$i=0;$ret = "";
	foreach($txt as $it){
		if($i>0){$ret .= $c." ";}
		$del = Array("\n","\r","\n\r");
		$ret .= str_replace($del,'',$it);
		$i++;
	}
	return $ret;
}
$dir = fopen("php://stdin", 'r');
//$dir = fopen("input.txt", 'r');
$input = stream_get_contents($dir);
//print_r($input);
$intxt=explode("\n",$input);
$n = $intxt[0];
for($nl=1;$nl<count($intxt)-1;$nl){ //echo "<".$intxt[$nl]."
";
	$del = Array("\n","\r","\n\r");
	//$lne = str_replace($del,'',$lne);
	$lne = explode(" ",$intxt[$nl]);$nl++;
	$t = $lne[0]; //echo $t."
";
	$name = $lne[1];//echo $name."
";
	for($j=1;$j<=$t;$j++){ //echo "->".$intxt[$nl]."
";

		$number = explode("-",$intxt[$nl]);$nl++;
		$num1 = $number[0];
		$num2 = $number[1];
		$num3 = $number[2];

		if($num1+$num2+$num3 == 3*$num1){
			$mtaxi = @++$total[$name]['taxi'];
			if(@$max['taxi']<$mtaxi){$max['taxi'] = $mtaxi;}
		}else if($num1/10>$num1%10 && $num1%10>$num2/10 && $num2/10>$num2%10 && $num2%10>$num3/10  &&  $num3/10>$num3%10){
			$mpizza = @++$total[$name]['pizza'];
			if(@$max['pizza']<$mpizza){$max['pizza'] = $mpizza;}
		}else{
			$mgirl =@++$total[$name]['girl'];
			if(@$max['girl']<$mgirl){$max['girl'] = $mgirl;}
		}

	}
	if($t==0){
		@$total[$name]['taxi'] = 0;
		@$total[$name]['pizza'] = 0;
		@$total[$name]['girl'] = 0;
	}
}
//print_r($total);
foreach($total as $name => $tot){
	foreach($tot as $type => $val){
		if($val == $max[$type]){$ret[$type][] = $name;}
	}
}
//echo "\n";
//print_r($ret);
//solution
echo "If you want to call a taxi, you should call: ".joinA(",",$ret['taxi']).".\n";
echo "If you want to order a pizza, you should call: ".joinA(",",$ret['pizza']).".\n";
echo "If you want to go to a cafe with a wonderful girl, you should call: ".joinA(",",$ret['girl']).".";
?>

<?php
function joinA($c,$txt){
	$i=0;$ret = "";
	foreach($txt as $it){
		if($i>0){$ret .= $c." ";}
		$del = Array("\n","\r","\n\r");
		$ret .= str_replace($del,'',$it);
		$i++;
	}
	return $ret;
}
$dir = fopen("php://stdin", 'r');
//$dir = fopen("input.txt", 'r');
$input = stream_get_contents($dir);
//print_r($input);
$intxt=explode("\n",$input);
$n = $intxt[0];
for($nl=1;$nl<count($intxt);$nl){// echo "<".$intxt[$nl]."
";
	$lne = explode(" ",$intxt[$nl]);$nl++;
	$t = $lne[0]; //echo $t."
";
	$name = $lne[1];//echo $name."
";
	for($j=1;$j<=$t;$j++){ //echo "->".$intxt[$nl]."
";
		$number = explode("-",$intxt[$nl]);$nl++;
		$num1 = $number[0];
		$num2 = $number[1];
		$num3 = $number[2];

		if($num1+$num2+$num3 == 3*$num1){
			$mtaxi = @++$total[$name]['taxi'];
			if(@$max['taxi']<$mtaxi){$max['taxi'] = $mtaxi;}
		}else if($num1/10>$num1%10 && $num1%10>$num2/10 && $num2/10>$num2%10 && $num2%10>$num3/10  &&  $num3/10>$num3%10){
			$mpizza = @++$total[$name]['pizza'];
			if(@$max['pizza']<$mpizza){$max['pizza'] = $mpizza;}
		}else{
			$mgirl =@++$total[$name]['girl'];
			if(@$max['girl']<$mgirl){$max['girl'] = $mgirl;}
		}
	}
}
//print_r($total);
foreach($total as $name => $tot){
	foreach($tot as $type => $val){
		if($val == $max[$type]){ $ret[$type][] = $name;}
	}
}
//echo "\n";
//print_r($ret);
//solution
echo "If you want to call a taxi, you should call: ".joinA(",",$ret['taxi']).".\n";
echo "If you want to order a pizza, you should call: ".joinA(",",$ret['pizza']).".\n";
echo "If you want to go to a cafe with a wonderful girl, you should call: ".joinA(",",$ret['girl']);
?>

<?php
function joinA($c,$txt){
	$i=0;$ret = "";
	foreach($txt as $it){
		if($i>0){$ret .= $c." ";}
		$ret .= $it;
		$i++;
	}
	return $ret;
}
$dir = fopen("php://stdin", 'r');
//$dir = fopen("input.txt", 'r');
$input = stream_get_contents($dir);
//print_r($input);
$intxt=explode("\n",$input);
$n = $intxt[0];
for($nl=1;$nl<count($intxt);$nl){// echo "<".$intxt[$nl]."
";
	$lne = explode(" ",$intxt[$nl]);$nl++;
	$t = $lne[0]; //echo $t."
";
	$name = $lne[1];//echo $name."
";
	for($j=1;$j<=$t;$j++){ //echo "->".$intxt[$nl]."
";
		$number = explode("-",$intxt[$nl]);$nl++;
		$num1 = $number[0];
		$num2 = $number[1];
		$num3 = $number[2];

		if($num1+$num2+$num3 == 3*$num1){
			$mtaxi = @++$total[$name]['taxi'];
			if(@$max['taxi']<$mtaxi){$max['taxi'] = $mtaxi;}
		}else if($num1 > $num2 && $num2 > $num3){
			$mpizza = @++$total[$name]['pizza'];
			if(@$max['pizza']<$mpizza){$max['pizza'] = $mpizza;}
		}else{
			$mgirl =@++$total[$name]['girl'];
			if(@$max['girl']<$mgirl){$max['girl'] = $mgirl;}
		}
	}
}
//print_r($total);
foreach($total as $name => $tot){
	foreach($tot as $type => $val){
		if($val == $max[$type]){ $ret[$type][] = $name;}
	}
}
//print_r($ret);
//solution
echo "If you want to call a taxi, you should call: ".joinA(",",$ret['taxi']).".";
echo "If you want to order a pizza, you should call: ".joinA(",",$ret['pizza']).".";
echo "If you want to go to a cafe with a wonderful girl, you should call: ".joinA(",",$ret['girl']).".";
?>

<?php
error_reporting(0);

function joinA($c,$txt){
    $i=0;$ret = "";
    foreach($txt as $it){
        if($i>0){$ret .= $c." ";}
        $del = Array("\n","\r","\n\r");
        $ret .= str_replace($del,'',$it);
        $i++;
    }
    return $ret;
}
$dir = fopen("php://stdin", 'r');
//$dir = fopen("input.txt", 'r');
$input = stream_get_contents($dir);
//print_r($input);
$intxt=explode("\n",$input);
$n = $intxt[0];
$max['taxi'] = 0;
$max['pizza'] = 0;
$max['girl'] = 0;
for($nl=1;$nl<count($intxt);$nl){// echo "<".$intxt[$nl]."
";

    // Depura Linea //
    $del = Array("\n","\r","\n\r");
    $intxtln = str_replace($del,'',$intxt[$nl]);//echo "<".$intxtn."
";
    if(strlen($intxtln) == 0){break;}
    //

    $lne = explode(" ",$intxtln);$nl++;

    $t = $lne[0]; //echo $t."
";
    $name = $lne[1];//echo $name."
";
    $total[$name]['taxi'] = 0;
    $total[$name]['pizza'] = 0;
    $total[$name]['girl'] = 0;
    for($j=1;$j<=$t;$j++){ //echo "->".$intxt[$nl]."
";

        $number = explode("-",$intxt[$nl]);$nl++;
        $num1 = (int)$number[0];$dig11 = (int)($num1/10);$dig12 = (int)($num1%10);
        $num2 = (int)$number[1];$dig21 = (int)($num2/10);$dig22 = (int)($num2%10);
        $num3 = (int)$number[2];$dig31 = (int)($num3/10);$dig32 = (int)($num3%10);

        if($dig11>$dig12 && $dig12>$dig21 && $dig21>$dig22 && $dig22>$dig31 && $dig31>$dig32){
            $mpizza = @++$total[$name]['pizza'];
            if(@$max['pizza']<$mpizza){$max['pizza'] = $mpizza;}
        }else if($dig11 == $dig12 && $dig12 == $dig21 && $dig21 == $dig22 && $dig22 == $dig31 && $dig31 == $dig32){
            $mtaxi = @++$total[$name]['taxi'];
            if(@$max['taxi']<$mtaxi){$max['taxi'] = $mtaxi;}
        }else{
            $mgirl =@++$total[$name]['girl'];
            if(@$max['girl']<$mgirl){$max['girl'] = $mgirl;}
        }

    }
}
//print_r($total);
foreach($total as $name => $tot){
    foreach($tot as $type => $val){
        $ret[$type][] = $name;
    }
}
//echo "\n";
//print_r($ret);
//solution
echo "If you want to call a taxi, you should call: ".joinA(",",$ret['taxi']).".\n";
echo "If you want to order a pizza, you should call: ".joinA(",",$ret['pizza']).".\n";
echo "If you want to go to a cafe with a wonderful girl, you should call: ".joinA(",",$ret['girl']).".";
?>

<?php
error_reporting(0);

function joinA($c,$txt){
    $i=0;$ret = "";
    foreach($txt as $it){
        if($i>0){$ret .= $c." ";}
        $del = Array("\n","\r","\n\r");
        $ret .= str_replace($del,'',$it);
        $i++;
    }
    return $ret;
}
$dir = fopen("php://stdin", 'r');
//$dir = fopen("input.txt", 'r');
$input = stream_get_contents($dir);
//print_r($input);
$intxt=explode("\n",$input);
$n = $intxt[0];
$max['taxi'] = 0;
$max['pizza'] = 0;
$max['girl'] = 0;
for($nl=1;$nl<count($intxt);$nl){// echo "<".$intxt[$nl]."
";

    // Depura Linea //
    $del = Array("\n","\r","\n\r");
    $intxtln = str_replace($del,'',$intxt[$nl]);//echo "<".$intxtn."
";
    if(strlen($intxtln) == 0){break;}
    //

    $lne = explode(" ",$intxtln);$nl++;

    $t = $lne[0]; //echo $t."
";
    $name = $lne[1];//echo $name."
";
    $total[$name]['taxi'] = 0;
    $total[$name]['pizza'] = 0;
    $total[$name]['girl'] = 0;
    for($j=1;$j<=$t;$j++){ //echo "->".$intxt[$nl]."
";

        $number = explode("-",$intxt[$nl]);$nl++;
        $num1 = (int)$number[0];$dig11 = (int)($num1/10);$dig12 = (int)($num1%10);
        $num2 = (int)$number[1];$dig21 = (int)($num2/10);$dig22 = (int)($num2%10);
        $num3 = (int)$number[2];$dig31 = (int)($num3/10);$dig32 = (int)($num3%10);

        if($dig11>$dig12 && $dig12>$dig21 && $dig21>$dig22 && $dig22>$dig31 && $dig31>$dig32){
            $mpizza = @++$total[$name]['pizza'];
            if(@$max['pizza']<$mpizza){$max['pizza'] = $mpizza;}
        }else if(($dig11 + $dig12)==($dig21 + $dig22) && ($dig21 + $dig22)==($dig32 + $dig31)){
            $mtaxi = @++$total[$name]['taxi'];
            if(@$max['taxi']<$mtaxi){$max['taxi'] = $mtaxi;}
        }else{
            $mgirl =@++$total[$name]['girl'];
            if(@$max['girl']<$mgirl){$max['girl'] = $mgirl;}
        }

    }
}
//print_r($total);
foreach($total as $name => $tot){
    foreach($tot as $type => $val){
        if($val == $max[$type]){$ret[$type][] = $name;}
    }
}
//echo "\n";
//print_r($ret);
//solution
echo "If you want to call a taxi, you should call: ".joinA(",",$ret['taxi']).".\n";
echo "If you want to order a pizza, you should call: ".joinA(",",$ret['pizza']).".\n";
echo "If you want to go to a cafe with a wonderful girl, you should call: ".joinA(",",$ret['girl']).".";
?>


A number $$$a_2$$$ is said to be the arithmetic mean of two numbers $$$a_1$$$ and $$$a_3$$$, if the following condition holds: $$$a_1 + a_3 = 2\cdot a_2$$$. We define an arithmetic mean deviation of three numbers $$$a_1$$$, $$$a_2$$$ and $$$a_3$$$ as follows: $$$d(a_1, a_2, a_3) = |a_1 + a_3 - 2 \cdot a_2|$$$.Arithmetic means a lot to Jeevan. He has three numbers $$$a_1$$$, $$$a_2$$$ and $$$a_3$$$ and he wants to minimize the arithmetic mean deviation $$$d(a_1, a_2, a_3)$$$. To do so, he can perform the following operation any number of times (possibly zero):  Choose $$$i, j$$$ from $$$\{1, 2, 3\}$$$ such that $$$i \ne j$$$ and increment $$$a_i$$$ by $$$1$$$ and decrement $$$a_j$$$ by $$$1$$$ Help Jeevan find out the minimum value of $$$d(a_1, a_2, a_3)$$$ that can be obtained after applying the operation any number of times.

The first line contains a single integer $$$t$$$ $$$(1 \le t \le 5000)$$$  — the number of test cases. The first and only line of each test case contains three integers $$$a_1$$$, $$$a_2$$$ and $$$a_3$$$ $$$(1 \le a_1, a_2, a_3 \le 10^{8})$$$.

For each test case, output the minimum value of $$$d(a_1, a_2, a_3)$$$ that can be obtained after applying the operation any number of times.

NoteNote that after applying a few operations, the values of $$$a_1$$$, $$$a_2$$$ and $$$a_3$$$ may become negative.In the first test case, $$$4$$$ is already the Arithmetic Mean of $$$3$$$ and $$$5$$$.$$$d(3, 4, 5) = |3 + 5 - 2 \cdot 4| = 0$$$In the second test case, we can apply the following operation:$$$(2, 2, 6)$$$ $$$\xrightarrow[\text{increment $$$a_2$$$}]{\text{decrement $$$a_1$$$}}$$$ $$$(1, 3, 6)$$$$$$d(1, 3, 6) = |1 + 6 - 2 \cdot 3| = 1$$$It can be proven that answer can not be improved any further.In the third test case, we can apply the following operations:$$$(1, 6, 5)$$$ $$$\xrightarrow[\text{increment $$$a_3$$$}]{\text{decrement $$$a_2$$$}}$$$ $$$(1, 5, 6)$$$ $$$\xrightarrow[\text{increment $$$a_1$$$}]{\text{decrement $$$a_2$$$}}$$$ $$$(2, 4, 6)$$$$$$d(2, 4, 6) = |2 + 6 - 2 \cdot 4| = 0$$$

<?php
$array = [];
$t = (int)fgets(STDIN);
while ($t--) {
    $num = explode(" ", trim(fgets(STDIN)));

    $x = abs(($num[0] + $num[2]) - ($num[1] * 2));
    $z = $x - 3;

    if ($z % 3 == 0) {
        array_push($array, 0);
    } else {
        array_push($array, 1);
    }
}
foreach ($array as $key => $value)
    print($value . "\r\n");
$end = readline();

?>

<?php
$array = [];
$t = (int)fgets(STDIN);
while ($t--) {
    $num = explode(" ", '1 6 5');

    // $char = str_split(trim(fgets(STDIN)));

    $x = abs(($num[0] + $num[2]) - ($num[1] * 2));
    $z = $x - 3;

    if ($z % 3 == 0) {
        array_push($array, 0);
    } else {
        array_push($array, 1);
    }
}
foreach ($array as $key => $value)
    print($value . "\r\n");
$end = readline();
?>

<?php

$h = "";
$t = (int)fgets(STDIN);
while ($t--) {
    $str = trim(fgets(STDIN));
    $strExpload = explode(" ", $str);
    $d1 = $strExpload[0] + $strExpload[2];
    $d2 = $strExpload[1] * 2;
    $c = 100;
    while ($c--) {
        if ($strExpload[0] >= $strExpload[1]) {
            $strExpload[0] = $strExpload[0] - 1;
            $strExpload[1] = $strExpload[1] + 1;
        } elseif ($strExpload[1] >= $strExpload[2]) {
            $strExpload[1] = $strExpload[1] - 1;
            $strExpload[2] = $strExpload[2] + 1;
        } else {
            $a = $strExpload[0] + $strExpload[2];
            $b = $strExpload[1] * 2;
            if ($a < $d1 and $b < $d2) {
                $d1 = $strExpload[0] + $strExpload[2];
                $d2 = $strExpload[1] * 2;
            } else {
                break;
            }
        }
    }
    if (abs($d1 - $d2) > 0) {
        $h .= "1\n";
    } else {
        $h .= "0\n";
    }
}
echo $h;
$end = readline();
?>

<?php
$h = "";
$t = (int)fgets(STDIN);
while ($t--) {
    $str = trim(fgets(STDIN));
    $str = "2 2 6";

    $strExpload = explode(" ", $str);
    $d1 = $strExpload[0] + $strExpload[2];
    $d2 = $strExpload[1] * 2;
    $c = 100;
    while ($c--) {
        if ($strExpload[0] >= $strExpload[1]) {
            $strExpload[0] = $strExpload[0] - 1;
            $strExpload[1] = $strExpload[1] + 1;
        } elseif ($strExpload[1] >= $strExpload[2]) {
            $strExpload[1] = $strExpload[1] - 1;
            $strExpload[2] = $strExpload[2] + 1;
        } else {
            $a = $strExpload[0] + $strExpload[2];
            $b = $strExpload[1] * 2;
            if ($a < $d1 and $b < $d2) {
                $d1 = $strExpload[0] + $strExpload[2];
                $d2 = $strExpload[1] * 2;
            } else {
                break;
            }
        }
    }
    if (abs($d1 - $d2) > 0) {
        $h .= "1\n";
    } else {
        $h .= "0\n";
    }
}
echo $h;
$end = readline();
?>


You are given two strings $$$a$$$ and $$$b$$$ consisting of lowercase English letters, both of length $$$n$$$. The characters of both strings have indices from $$$1$$$ to $$$n$$$, inclusive. You are allowed to do the following changes:   Choose any index $$$i$$$ ($$$1 \le i \le n$$$) and swap characters $$$a_i$$$ and $$$b_i$$$;  Choose any index $$$i$$$ ($$$1 \le i \le n$$$) and swap characters $$$a_i$$$ and $$$a_{n - i + 1}$$$;  Choose any index $$$i$$$ ($$$1 \le i \le n$$$) and swap characters $$$b_i$$$ and $$$b_{n - i + 1}$$$. Note that if $$$n$$$ is odd, you are formally allowed to swap $$$a_{\lceil\frac{n}{2}\rceil}$$$ with $$$a_{\lceil\frac{n}{2}\rceil}$$$ (and the same with the string $$$b$$$) but this move is useless. Also you can swap two equal characters but this operation is useless as well.You have to make these strings equal by applying any number of changes described above, in any order. But it is obvious that it may be impossible to make two strings equal by these swaps.In one preprocess move you can replace a character in $$$a$$$ with another character. In other words, in a single preprocess move you can choose any index $$$i$$$ ($$$1 \le i \le n$$$), any character $$$c$$$ and set $$$a_i := c$$$.Your task is to find the minimum number of preprocess moves to apply in such a way that after them you can make strings $$$a$$$ and $$$b$$$ equal by applying some number of changes described in the list above.Note that the number of changes you make after the preprocess moves does not matter. Also note that you cannot apply preprocess moves to the string $$$b$$$ or make any preprocess moves after the first change is made.

The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of strings $$$a$$$ and $$$b$$$. The second line contains the string $$$a$$$ consisting of exactly $$$n$$$ lowercase English letters. The third line contains the string $$$b$$$ consisting of exactly $$$n$$$ lowercase English letters.

Print a single integer — the minimum number of preprocess moves to apply before changes, so that it is possible to make the string $$$a$$$ equal to string $$$b$$$ with a sequence of changes from the list above.

NoteIn the first example preprocess moves are as follows: $$$a_1 := $$$'b', $$$a_3 := $$$'c', $$$a_4 := $$$'a' and $$$a_5:=$$$'b'. Afterwards, $$$a = $$$"bbcabba". Then we can obtain equal strings by the following sequence of changes: $$$swap(a_2, b_2)$$$ and $$$swap(a_2, a_6)$$$. There is no way to use fewer than $$$4$$$ preprocess moves before a sequence of changes to make string equal, so the answer in this example is $$$4$$$.In the second example no preprocess moves are required. We can use the following sequence of changes to make $$$a$$$ and $$$b$$$ equal: $$$swap(b_1, b_5)$$$, $$$swap(a_2, a_4)$$$.


Appleman and Toastman play a game. Initially Appleman gives one group of n numbers to the Toastman, then they start to complete the following tasks:  Each time Toastman gets a group of numbers, he sums up all the numbers and adds this sum to the score. Then he gives the group to the Appleman.  Each time Appleman gets a group consisting of a single number, he throws this group out. Each time Appleman gets a group consisting of more than one number, he splits the group into two non-empty groups (he can do it in any way) and gives each of them to Toastman. After guys complete all the tasks they look at the score value. What is the maximum possible value of score they can get?

The first line contains a single integer n (1 ≤ n ≤ 3·105). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the initial group that is given to Toastman.

Print a single integer — the largest possible score.

NoteConsider the following situation in the first example. Initially Toastman gets group [3, 1, 5] and adds 9 to the score, then he give the group to Appleman. Appleman splits group [3, 1, 5] into two groups: [3, 5] and [1]. Both of them should be given to Toastman. When Toastman receives group [1], he adds 1 to score and gives the group to Appleman (he will throw it out). When Toastman receives group [3, 5], he adds 8 to the score and gives the group to Appleman. Appleman splits [3, 5] in the only possible way: [5] and [3]. Then he gives both groups to Toastman. When Toastman receives [5], he adds 5 to the score and gives the group to Appleman (he will throws it out). When Toastman receives [3], he adds 3 to the score and gives the group to Appleman (he will throws it out). Finally Toastman have added 9 + 1 + 8 + 5 + 3 = 26 to the score. This is the optimal sequence of actions.

<?php
// 461A     Яблов и Тостов
$in = fopen("php://stdin", 'r');

$input_line = fgets($in);
$n = (int) $input_line;

$input_line = fgets($in);
$arr = preg_split('/ /', substr($input_line, 0, strlen($input_line)-2), -1, PREG_SPLIT_NO_EMPTY);

foreach ($arr as $key => &$value) {
    $value = (int) $value;
}
unset($value);

sort($arr);

$x = $arr[$n-1];
$x = (string) $x;
$sum = bcmul($x, $n);

for ($i=0; $i < $n-1; $i++) {
    $sum = bcadd($sum, bcmul((string) $arr[$i], (string) ($i + 2)));
}
echo $sum;

?>

<?php
$a = trim(fgets(STDIN));
$b = explode(" ", trim(fgets(STDIN)));
if($a == 1)
{
    print $b[0];
}
else
{
    sort($b);
    $c = array_sum($b);
    $e = $c;
    for($x = 0; $x < $a - 1; $x++)
    {
        $d = $e;
        $c += $d;
        if(count($b) == 2)
        {
            break;
        }
        else
        {
            $e -= $b[$x];
        }
    }
    print $c;
}
?>

<?php
$a = trim(fgets(STDIN));
$b = explode(" ", trim(fgets(STDIN)));
if($a == 1)
{
    print $b[0];
}
else
{
    sort($b);
    $c = array_sum($b);
    for($x = 1; $x <= 2; $x++)
    {
        $d = array_sum($b);
        $c += $d;
        if(count($b) == 2)
        {
            break;
        }
        else
        {
            unset($b[0]);
        }
    }
    print $c;
}
?>

<?php
// 461A     Яблов и Тостов
$in = fopen("php://stdin", 'r');

$input_line = fgets($in);
$n = (int) $input_line;

$input_line = fgets($in);
$arr = preg_split('/ /', substr($input_line, 0, strlen($input_line)-2), -1, PREG_SPLIT_NO_EMPTY);

foreach ($arr as $key => &$value) {
    $value = (int) $value;
}
unset($value);

// $sum = array_sum($arr);
sort($arr);
$sum = $arr[$n-1] * $n;

/*
while ( count($arr) > 1) {
    $sum += array_sum($arr);
    array_pop($arr);
}
*/

for ($i=0; $i < $n-1; $i++) {
    $sum += $arr[$i] * ($i + 2);
}
echo $sum;

?>

<?php
// 461A     Яблов и Тостов
$in = fopen("php://stdin", 'r');

$input_line = fgets($in);
$n = (int) $input_line;

$input_line = fgets($in);
$arr = preg_split('/ /', substr($input_line, 0, strlen($input_line)-2), -1, PREG_SPLIT_NO_EMPTY);

foreach ($arr as $key => &$value) {
    $value = (int) $value;
}
unset($value);

$sum = array_sum($arr);
rsort($arr);

while ( count($arr) > 1) {
    $sum += array_sum($arr);
    array_pop($arr);
echo "sum=$sum \n";
}

echo $sum;

?>


You are given a string $$$s$$$ of even length $$$n$$$. String $$$s$$$ is binary, in other words, consists only of 0's and 1's.String $$$s$$$ has exactly $$$\frac{n}{2}$$$ zeroes and $$$\frac{n}{2}$$$ ones ($$$n$$$ is even).In one operation you can reverse any substring of $$$s$$$. A substring of a string is a contiguous subsequence of that string.What is the minimum number of operations you need to make string $$$s$$$ alternating? A string is alternating if $$$s_i \neq s_{i + 1}$$$ for all $$$i$$$. There are two types of alternating strings in general: 01010101... or 10101010...

The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$; $$$n$$$ is even) — the length of string $$$s$$$. The second line of each test case contains a binary string $$$s$$$ of length $$$n$$$ ($$$s_i \in$$$ {0, 1}). String $$$s$$$ has exactly $$$\frac{n}{2}$$$ zeroes and $$$\frac{n}{2}$$$ ones. It's guaranteed that the total sum of $$$n$$$ over test cases doesn't exceed $$$10^5$$$.

For each test case, print the minimum number of operations to make $$$s$$$ alternating.

NoteIn the first test case, string 10 is already alternating.In the second test case, we can, for example, reverse the last two elements of $$$s$$$ and get: 0110 $$$\rightarrow$$$ 0101.In the third test case, we can, for example, make the following two operations:   11101000 $$$\rightarrow$$$ 10101100;  10101100 $$$\rightarrow$$$ 10101010.

<?php

ob_start(null, 65536);

$__ln = explode("\n", file_get_contents("php://stdin"));
$__lc = 0;

function nl() {
    global $__ln, $__lc;
    return $__ln[$__lc++];
}

function nla() {
    global $__ln, $__lc;
    return explode(" ", $__ln[$__lc++]);
}

function asInt($x) {
    return (int)$x;
}

function asDouble($x) {
    return (double)$x;
}

$tc = asInt(nl());
for($cc=0; $cc<$tc; $cc++) {
    $n = asInt(nl());
    $o = 0; $to = 0;
    $z = 0; $tz = 0;
    foreach(str_split(nl()) as $ch) {
        if($ch == "1") {
            $o++;
            $tz += $z ? $z-1 : 0;
            $z = 0;
        } else {
            $z++;
            $to += $o ? $o-1 : 0;
            $o = 0;
        }
    }
    echo max($tz, $to) . "\n";
}


Manao has invented a new mathematical term — a beautiful set of points. He calls a set of points on a plane beautiful if it meets the following conditions:  The coordinates of each point in the set are integers.  For any two points from the set, the distance between them is a non-integer. Consider all points (x, y) which satisfy the inequations: 0 ≤ x ≤ n; 0 ≤ y ≤ m; x + y > 0. Choose their subset of maximum size such that it is also a beautiful set of points.

The single line contains two space-separated integers n and m (1 ≤ n, m ≤ 100).

In the first line print a single integer — the size k of the found beautiful set. In each of the next k lines print a pair of space-separated integers — the x- and y- coordinates, respectively, of a point from the set. If there are several optimal solutions, you may print any of them.

NoteConsider the first sample. The distance between points (0, 1) and (1, 2) equals , between (0, 1) and (2, 0) — , between (1, 2) and (2, 0) — . Thus, these points form a beautiful set. You cannot form a beautiful set with more than three points out of the given points. Note that this is not the only solution.

<?
list($x, $y) = explode(' ', trim(fgets(STDIN)));
$count = min(Array($x, $y)) + 1;
echo $count."\n";
for($i = 0; $i <= $x; $i++){
    if(($t = $y--) >= 0)
        echo $i.' '.($t)."\n";
    else
        break;
}

<?
list($x, $y) = explode(' ', trim(fgets(STDIN)));
$count = min(Array($x, $y)) + 1;
echo $count."\n";
for($i = 0; $i < $count - 1; $i++){
    echo $i.' '.($i+1)."\n";
}
echo $i.' 0';

<?
list($x, $y) = explode(' ', trim(fgets(STDIN)));
$count = min(Array($x, $y)) + 1;
echo $count."\n";
for($i = 0; $i < $count; $i++){
    echo $i.' '.$i."\n";
}


You have a sequence $$$a_1, a_2, \ldots, a_n$$$ of length $$$n$$$, consisting of integers between $$$1$$$ and $$$m$$$. You also have a string $$$s$$$, consisting of $$$m$$$ characters B.You are going to perform the following $$$n$$$ operations.   At the $$$i$$$-th ($$$1 \le i \le n$$$) operation, you replace either the $$$a_i$$$-th or the $$$(m + 1 - a_i)$$$-th character of $$$s$$$ with A. You can replace the character at any position multiple times through the operations. Find the lexicographically smallest string you can get after these operations.A string $$$x$$$ is lexicographically smaller than a string $$$y$$$ of the same length if and only if in the first position where $$$x$$$ and $$$y$$$ differ, the string $$$x$$$ has a letter that appears earlier in the alphabet than the corresponding letter in $$$y$$$.

The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 2000$$$). The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 50$$$) — the length of the sequence $$$a$$$ and the length of the string $$$s$$$ respectively. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le m$$$) — the sequence $$$a$$$.

For each test case, print a string of length $$$m$$$ — the lexicographically smallest string you can get. Each character of the string should be either capital English letter A or capital English letter B.

NoteIn the first test case, the sequence $$$a = [1, 1, 3, 1]$$$. One of the possible solutions is the following.   At the $$$1$$$-st operation, you can replace the $$$1$$$-st character of $$$s$$$ with A. After it, $$$s$$$ becomes ABBBB.  At the $$$2$$$-nd operation, you can replace the $$$5$$$-th character of $$$s$$$ with A (since $$$m+1-a_2=5$$$). After it, $$$s$$$ becomes ABBBA.  At the $$$3$$$-rd operation, you can replace the $$$3$$$-rd character of $$$s$$$ with A. After it, $$$s$$$ becomes ABABA.  At the $$$4$$$-th operation, you can replace the $$$1$$$-st character of $$$s$$$ with A. After it, $$$s$$$ remains equal to ABABA.  The resulting string is ABABA. It is impossible to produce a lexicographically smaller string.In the second test case, you are going to perform only one operation. You can replace either the $$$2$$$-nd character or $$$4$$$-th character of $$$s$$$ with A. You can get strings BABBB and BBBAB after the operation. The string BABBB is the lexicographically smallest among these strings.In the third test case, the only string you can get is A.In the fourth test case, you can replace the $$$1$$$-st and $$$2$$$-nd characters of $$$s$$$ with A to get AABB.In the fifth test case, you can replace the $$$1$$$-st and $$$3$$$-rd characters of $$$s$$$ with A to get ABABBBB.

<?php

function read() {
  return trim(fgets(STDIN)) ;
}

function readInt() {
  return (int) read() ;
}

function readStrs() {
  return explode(" ",read()) ;
}

function readIntArray() {
  return array_map('intval', readStrs());
}

function readAsArray() {
  return str_split(read()) ;
}

function printLine($arg) {
  if($arg === false) {
    print_r("false") ;
  }
  elseif($arg === true) {
    print_r("true") ;
  }
  else {
    print_r($arg) ;
  }
  print_r("\n") ;
}

$t = readInt() ;

while($t--) {
	[$n,$m] = readIntArray() ;
	$arr = readIntArray() ;
	$fin = array_fill(0,$m,'B') ;
	// printLine($fin) ;
	foreach ($arr as $ele) {
		$c_ele = $m+1 - $ele ;
		$min = ($ele < $c_ele) ? $ele : $c_ele ;
		$max = $m + 1 - $min ;
		if($fin[$min-1] == "B") {
			$fin[$min-1] = "A" ;
		}
		else {
			$fin[$max-1] = "A" ;
		}
	}
	printLine(implode("", $fin));
}


A string t is called an anagram of the string s, if it is possible to rearrange letters in t so that it is identical to the string s. For example, the string "aab" is an anagram of the string "aba" and the string "aaa" is not.The string t is called a substring of the string s if it can be read starting from some position in the string s. For example, the string "aba" has six substrings: "a", "b", "a", "ab", "ba", "aba".You are given a string s, consisting of lowercase Latin letters and characters "?". You are also given a string p, consisting of lowercase Latin letters only. Let's assume that a string is good if you can obtain an anagram of the string p from it, replacing the "?" characters by Latin letters. Each "?" can be replaced by exactly one character of the Latin alphabet. For example, if the string p = «aba», then the string "a??" is good, and the string «?bc» is not. Your task is to find the number of good substrings of the string s (identical substrings must be counted in the answer several times).

The first line is non-empty string s, consisting of no more than 105 lowercase Latin letters and characters "?". The second line is non-empty string p, consisting of no more than 105 lowercase Latin letters. Please note that the length of the string p can exceed the length of the string s.

Print the single number representing the number of good substrings of string s. Two substrings are considered different in their positions of occurrence are different. Thus, if some string occurs several times, then it should be counted the same number of times.

NoteConsider the first sample test. Here the string s has two good substrings: "b??" (after we replace the question marks we get "baa"), "???" (after we replace the question marks we get "baa").Let's consider the second sample test. Here the string s has two good substrings: "ab?" ("?" can be replaced by "c"), "b?c" ("?" can be replaced by "a").


You are given a rectangular grid of lattice points from (0, 0) to (n, m) inclusive. You have to choose exactly 4 different points to build a polyline possibly with self-intersections and self-touching. This polyline should be as long as possible.A polyline defined by points p1, p2, p3, p4 consists of the line segments p1 p2, p2 p3, p3 p4, and its length is the sum of the lengths of the individual line segments.

The only line of the input contains two integers n and m (0 ≤ n, m ≤ 1000). It is guaranteed that grid contains at least 4 different points.

Print 4 lines with two integers per line separated by space — coordinates of points p1, p2, p3, p4 in order which represent the longest possible polyline. Judge program compares your answer and jury's answer with 10 - 6 precision.


Vasya the Great Magician and Conjurer loves all kinds of miracles and wizardry. In one wave of a magic wand he can turn an object into something else. But, as you all know, there is no better magic in the Universe than the magic of numbers. That's why Vasya adores math and spends a lot of time turning some numbers into some other ones.This morning he has n cards with integers lined up in front of him. Each integer is not less than 1, but not greater than l. When Vasya waves his magic wand, two rightmost cards vanish from the line and a new card magically appears in their place. It contains the difference between the left and the right numbers on the two vanished cards. Vasya was very interested to know what would happen next, and so he waved with his magic wand on and on, until the table had a single card left.Suppose that Vasya originally had the following cards: 4, 1, 1, 3 (listed from left to right). Then after the first wave the line would be: 4, 1, -2, and after the second one: 4, 3, and after the third one the table would have a single card with number 1.Please note that in spite of the fact that initially all the numbers on the cards were not less than 1 and not greater than l, the numbers on the appearing cards can be anything, no restrictions are imposed on them.It is now evening. Vasya is very tired and wants to return everything back, but does not remember which cards he had in the morning. He only remembers that there were n cards, they contained integers from 1 to l, and after all magical actions he was left with a single card containing number d.Help Vasya to recover the initial set of cards with numbers.

The single line contains three space-separated integers: n (2 ≤ n ≤ 100) — the initial number of cards on the table, d (|d| ≤ 104) — the number on the card that was left on the table after all the magical actions, and l (1 ≤ l ≤ 100) — the limits for the initial integers.

If Vasya is mistaken, that is, if there doesn't exist a set that meets the requirements given in the statement, then print a single number -1, otherwise print the sought set containing n integers from 1 to l. Separate the integers by spaces. Print the integers in the order, in which they were written on the cards from left to right. If there are several suitable sets of numbers, you can print any of them.

<?php
	// God & me
	// I found myself in Love empire !
	$INPUTS = preg_split("/[\s]+/", file_get_contents('php://stdin'));
	function in(){
		static $i = 0;
		global $INPUTS;
		return $INPUTS[$i++];
	}
	$n = in();  $last = in();  $mx = in();
	for($i = 0; $i < $n; $i++){
		$a[$i] = $last > 0 ? $mx : 1;
		$last = $a[$i] - $last;
	}
	$a[$n - 1] -= $last;
	if($a[$n - 1] < 1 || $a[$n - 1] > $mx)
		echo -1;
	else
		for($i = 0; $i < $n; $i++)
			echo $a[$i]. ' ';
?>

<?php
	// God & me
	// I found myself in Love empire !
	$INPUTS = preg_split("/[\s]+/", file_get_contents('php://stdin'));
	function in(){
		static $i = 0;
		global $INPUTS;
		return $INPUTS[$i++];
	}
	$n = in();  $last = in();  $mx = in();
	for($i = 0; $i < $n; $i++){
		$a[$i] = $last > 0 ? $mx : 1;
		$last = $a[$i] - $last;
	}
	if($a[$n - 1] < 1 || $a[$n - 1] > $mx)
		echo -1;
	else
		for($i = 0; $i < $n; $i++)
			echo $a[$i]. ' ';
?>


Polycarp bought a new expensive painting and decided to show it to his $$$n$$$ friends. He hung it in his room. $$$n$$$ of his friends entered and exited there one by one. At one moment there was no more than one person in the room. In other words, the first friend entered and left first, then the second, and so on.It is known that at the beginning (before visiting friends) a picture hung in the room. At the end (after the $$$n$$$-th friend) it turned out that it disappeared. At what exact moment it disappeared — there is no information.Polycarp asked his friends one by one. He asked each one if there was a picture when he entered the room. Each friend answered one of three:  no (response encoded with 0);  yes (response encoded as 1);  can't remember (response is encoded with ?). Everyone except the thief either doesn't remember or told the truth. The thief can say anything (any of the three options).Polycarp cannot understand who the thief is. He asks you to find out the number of those who can be considered a thief according to the answers.

The first number $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The following is a description of test cases. The first line of each test case contains one string $$$s$$$ (length does not exceed $$$2 \cdot 10^5$$$) — a description of the friends' answers, where $$$s_i$$$ indicates the answer of the $$$i$$$-th friend. Each character in the string is either 0 or 1 or ?. The given regularity is described in the actual situation. In particular, on the basis of answers, at least one friend can be suspected of stealing a painting. It is guaranteed that the sum of string lengths over the entire input data set does not exceed $$$2 \cdot 10^5$$$.

Output one positive (strictly more zero) number – the number of people who could steal the picture based on the data shown.

NoteIn the first case, the answer is $$$1$$$ since we had exactly $$$1$$$ friend.The second case is similar to the first.In the third case, the suspects are the third and fourth friends (we count from one). It can be shown that no one else could be the thief.In the fourth case, we know absolutely nothing, so we suspect everyone.

<?php
$no = 'NO';
$yes = 'YES';
$mod = 1000000007;
$alph = 'abcdefghijklmnopqrstuvwxyz';
$inter = "\n";

  $t = getT();
//   $point = ord('a') + ord('b') ;

  for($q=0; $q <$t; $q++) {
      $ans = 0;
      $s = getT();

      $len = strlen($s);
      $l = 0;
      $r = $len - 1;

      for($i=0; $i<$len; $i++) {
          if($s[$i] == '1') {
             $l = $i;
          }
      }

      for($i=$len-1; $i>-1; $i--) {
          if($s[$i] == '0') {
             $r = $i;
          }
      }

      $ans = $r - $l + 1;
      pr($ans);

  }
// bcadd — Add two arbitrary precision numbers
// bccomp — Compare two arbitrary precision numbers
// bcdiv — Divide two arbitrary precision numbers
// bcmod — Get modulus of an arbitrary precision number
// bcmul — Multiply two arbitrary precision numbers
// bcpow — Raise an arbitrary precision number to another
// bcpowmod — Raise an arbitrary precision number to another, reduced by a specified modulus
// bcscale — Set or get default scale parameter for all bc math functions
// bcsqrt — Get the square root of an arbitrary precision number
// bcsub — Subtract one arbitrary precision number from another
function getDar($n) {
    $dar = [2];
    for($i=0; $i<$n; $i++) {
        $dar[] = $dar[$i] * 2;
    }
    return $dar;
}
  function ComandR($aCordinate) {
      return [$aCordinate[0] + 1, $aCordinate[1]];
  }
  function ComandL($aCordinate) {
      return [$aCordinate[0] - 1, $aCordinate[1]];
  }
  function ComandU($aCordinate) {
      return [$aCordinate[0], $aCordinate[1] + 1];
  }
  function ComandD($aCordinate) {
      return [$aCordinate[0], $aCordinate[1] - 1];
  }

  function getT() {
      return trim(fgets(STDIN));
  }
  function getA() {
      return explode(' ', trim(fgets(STDIN)));
  }

  function is_prime($n) {
    $d = 2;
        while ($n % $d != 0) {
        	 $d += 1;
        }

        return $d == $n;
    }
function getMinValue($x, $y) {
        return $x > $y ? $y : $x;
    }
    function getMaxValue($x, $y) {
        return $x > $y ? $x : $y;
    }

    function getMaxValueBc($x, $y) {
        return bccomp($x, $y) == 1 ? $x : $y;
    }
    function getRotate($a, $s, $e, $ind) {
 		$ar = [];
        for ($i= $s; $i<=$e; $i++) {
        	$ar[$i] = $a[$i];
        	$j = $i + $ind > $e ? $i + $ind - $e - 1 : $i + $ind;
        	// echo $i, ' ', $j, ' ', $j < $i ? $ar[$j] : $a[$j] , "\n";
        	$a[$i] = $j < $i ? $ar[$j] : $a[$j];
        }
        return $a;
    }
    function pr($s) {
        if(is_array($s)) {
            echo explode( ' ', $s), PHP_EOL;
        } else {
            echo $s, PHP_EOL;
        }
    }
    function fab2($n, $a) {
        if($n <= 1) {
            return $a[$n];
        }
       for($i=2; $i<=$n; $i++) {
           $a[$i] = $a[$i-1] + $a[$i-2];
       }

        return $a[$n];
    }


DZY loves chessboard, and he enjoys playing with it.He has a chessboard of n rows and m columns. Some cells of the chessboard are bad, others are good. For every good cell, DZY wants to put a chessman on it. Each chessman is either white or black. After putting all chessmen, DZY wants that no two chessmen with the same color are on two adjacent cells. Two cells are adjacent if and only if they share a common edge.You task is to find any suitable placement of chessmen on the given chessboard.

The first line contains two space-separated integers n and m (1 ≤ n, m ≤ 100). Each of the next n lines contains a string of m characters: the j-th character of the i-th string is either "." or "-". A "." means that the corresponding cell (in the i-th row and the j-th column) is good, while a "-" means it is bad.

Output must contain n lines, each line must contain a string of m characters. The j-th character of the i-th string should be either "W", "B" or "-". Character "W" means the chessman on the cell is white, "B" means it is black, "-" means the cell is a bad cell. If multiple answers exist, print any of them. It is guaranteed that at least one answer exists.

NoteIn the first sample, DZY puts a single black chessman. Of course putting a white one is also OK.In the second sample, all 4 cells are good. No two same chessmen share an edge in the sample output.In the third sample, no good cells are adjacent. So you can just put 3 chessmen, no matter what their colors are.


Petya has recently learned data structure named "Binary heap".The heap he is now operating with allows the following operations:   put the given number into the heap;  get the value of the minimum element in the heap;  extract the minimum element from the heap; Thus, at any moment of time the heap contains several integers (possibly none), some of them might be equal.In order to better learn this data structure Petya took an empty heap and applied some operations above to it. Also, he carefully wrote down all the operations and their results to his event log, following the format:   insert x — put the element with value x in the heap;  getMin x — the value of the minimum element contained in the heap was equal to x;  removeMin — the minimum element was extracted from the heap (only one instance, if there were many). All the operations were correct, i.e. there was at least one element in the heap each time getMin or removeMin operations were applied.While Petya was away for a lunch, his little brother Vova came to the room, took away some of the pages from Petya's log and used them to make paper boats.Now Vova is worried, if he made Petya's sequence of operations inconsistent. For example, if one apply operations one-by-one in the order they are written in the event log, results of getMin operations might differ from the results recorded by Petya, and some of getMin or removeMin operations may be incorrect, as the heap is empty at the moment they are applied.Now Vova wants to add some new operation records to the event log in order to make the resulting sequence of operations correct. That is, the result of each getMin operation is equal to the result in the record, and the heap is non-empty when getMin ad removeMin are applied. Vova wants to complete this as fast as possible, as the Petya may get back at any moment. He asks you to add the least possible number of operation records to the current log. Note that arbitrary number of operations may be added at the beginning, between any two other operations, or at the end of the log.

The first line of the input contains the only integer n (1 ≤ n ≤ 100 000) — the number of the records left in Petya's journal. Each of the following n lines describe the records in the current log in the order they are applied. Format described in the statement is used. All numbers in the input are integers not exceeding 109 by their absolute value.

The first line of the output should contain a single integer m — the minimum possible number of records in the modified sequence of operations. Next m lines should contain the corrected sequence of records following the format of the input (described in the statement), one per line and in the order they are applied. All the numbers in the output should be integers not exceeding 109 by their absolute value. Note that the input sequence of operations must be the subsequence of the output sequence. It's guaranteed that there exists the correct answer consisting of no more than 1 000 000 operations.

6
insert 1
insert 1
removeMin
removeMin
insert 2
getMin 2

NoteIn the first sample, after number 3 is inserted into the heap, the minimum number is 3. To make the result of the first getMin equal to 4 one should firstly remove number 3 from the heap and then add number 4 into the heap.In the second sample case number 1 is inserted two times, so should be similarly removed twice.

<?php
$fp = fopen('php://stdin', 'r');
$n = (int)fgets($fp);
$heap = new SplMinHeap();
$result = [];

for($i = 0; $i < $n; ++$i) {
	$ln = fgets($fp);
	if (strcmp($ln, "removeMin") >= 0) {
		if ($heap->count() == 0) {
			$result[] = "insert 0\n";
		} else {
			$heap->extract();
		}
	} else {
		list($op, $arg) = explode(' ', $ln);
		$arg = intval($arg);
		if ($op == 'insert') {
			$heap->insert($arg);
		} else {
			while($heap->count() && $heap->top() < $arg) {
				$result[] = "removeMin\n";
				$heap->extract();
			}
			if ($heap->count() == 0 || $heap->top() > $arg) {
				$result[] = "insert $arg\n";
				$heap->insert($arg);
			}
		}
	}
	$result[] = $ln;
}
echo count($result)."\n";
echo implode("", $result);

<?php
$fp = fopen('php://stdin', 'r');
$n = (int)fgets($fp);
$heap = [];
$result = [];

for($i = 0; $i < $n; ++$i) {
	$ln = fgets($fp);
	if (strcmp($ln, "removeMin") >= 0) {
		if (count($heap) == 0) {
			$result[] = "insert 0\n";
		} else {
			array_shift($heap);
		}
	} else {
		list($op, $arg) = explode(' ', $ln);
		$arg = intval($arg);
		if ($op == 'insert') {
			$heap[] = $arg;
			sort($heap);
		} else {
			while(count($heap) && $heap[0] < $arg) {
				$result[] = "removeMin\n";
				array_shift($heap);
			}
			if (count($heap) == 0 || $heap[0] > $arg) {
				$result[] = "insert $arg\n";
			}
		}
	}
	$result[] = $ln;
}
echo count($result)."\n";
echo implode("", $result);


Once upon a time a little frog whose name was Vasya decided to travel around his home swamp. Overall there are n mounds on the swamp, located on one line. The distance between the neighboring mounds is one meter. Vasya wants to visit all the mounds in one day; besides, he wants to visit each one exactly once. For that he makes a route plan, to decide the order in which to jump on the mounds. Vasya can pick any mound as the first one. He thinks it boring to jump two times at the same distance. That's why he wants any two jumps on his route to have different lengths. Help Vasya the Frog and make the plan for him.

The single line contains a number n (1 ≤ n ≤ 104) which is the number of mounds.

Print n integers pi (1 ≤ pi ≤ n) which are the frog's route plan.    All the pi's should be mutually different.  All the |pi–pi + 1|'s should be mutually different (1 ≤ i ≤ n - 1).  If there are several solutions, output any.

<?php

$stdin = fopen('php://stdin', 'r');

list($count) = fscanf($stdin, "%d");

echo "1";

$step = $count-1;
$napr = 1;
$pos = 1;
while ($step) {
    $pos += $step*$napr;
    echo " $pos";
    $napr *= -1;
    $step--;
}
echo "\n";

exit;