<?PHP
$fileIN = fopen("php://stdin", "r");
$fileOUT = fopen("php://stdout", "w");

$line = explode(" ", trim(fgets($fileIN)));
$n = $line[0];
$k = $line[1];

$friendmap = array();
$possibleFriendMap = array();

for ($i = 0; $i < $n; ++$i) {
    $line = explode(" ", trim(fgets($fileIN)));
    if (!isset($friendmap[$line[0]])) {
        $friendmap[$line[0]] = array();
        array_push($friendmap[$line[0]], $line[1]);
    } else {
        array_push($friendmap[$line[0]], $line[1]);
    }
    if (!isset($friendmap[$line[1]])) {
        $friendmap[$line[1]] = array();
        array_push($friendmap[$line[1]], $line[0]);
    } else {
        array_push($friendmap[$line[1]], $line[0]);
    }
}

function ver($a, $b) {
    global $friendmap;
    $common = 0;
    foreach ($friendmap[$a] as $k1 => $v1) {
        foreach ($friendmap[$b] as $k2 => $v2) {
            if ($v1 == $v2) {
                $common++;
            }
        }
    }
    return ($common);
}

function areFriends($a, $b) {
    global $friendmap;
    foreach ($friendmap[$a] as $key => $value) {
        if ($value == $b) {
            return true;
        }
    }
    return false;
}

// foreach ($friendmap as $key => $value) {
//  echo $key . " : " . count($friendmap[$key]) . " ";
//  foreach ($friendmap[$key] as $key2 => $value2) {
//      echo $value2 . " ";
//  }
//  echo "<br>";
// }

foreach ($friendmap as $key1 => $v1) {
    foreach ($friendmap as $key2 => $v2) {
        if ($key1 != $key2) {
            if (!isset($possibleFriendMap[$key1])) {
                $possibleFriendMap[$key1] = array();
            }
            if (!isset($possibleFriendMap[$key2])) {
                $possibleFriendMap[$key2] = array();
            }
            if (!areFriends($key1, $key2)) {
                if (ver($key1, $key2) * 100 >= sizeof($friendmap[$key1]) * $k) {
                    array_push($possibleFriendMap[$key1], $key2);
                }
            }
        }
    }
}

ksort($possibleFriendMap);
foreach ($possibleFriendMap as $key => $value) {
    sort($possibleFriendMap[$key]);
}

foreach ($possibleFriendMap as $key => $value) {
    fprintf($fileOUT, $key . ": " . count($possibleFriendMap[$key]) . " ");
    foreach ($possibleFriendMap[$key] as $key2 => $value2) {
        fprintf($fileOUT, $value2 . " ");
    }
    fprintf($fileOUT, "\n");
}

fclose($fileOUT);
fclose($fileIN);
?>

<?PHP
$fileIN = fopen("php://stdin", "r");
$fileOUT = fopen("php://stdout", "w");

$line = explode(" ", trim(fgets($fileIN)));
$n = $line[0];
$k = $line[1];

$friendmap = array();
$possibleFriendMap = array();

for ($i = 0; $i < $n; ++$i) {
    $line = explode(" ", trim(fgets($fileIN)));
    if (!isset($friendmap[$line[0]])) {
        $friendmap[$line[0]] = array();
        $possibleFriendMap[$line[0]] = array();
        array_push($friendmap[$line[0]], $line[1]);
    } else {
        array_push($friendmap[$line[0]], $line[1]);
    }
    if (!isset($friendmap[$line[1]])) {
        $friendmap[$line[1]] = array();
        $possibleFriendMap[$line[0]] = array();
        array_push($friendmap[$line[1]], $line[0]);
    } else {
        array_push($friendmap[$line[1]], $line[0]);
    }
}

function ver($a, $b) {
    global $friendmap;
    $common = 0;
    foreach ($friendmap[$a] as $k1 => $v1) {
        foreach ($friendmap[$b] as $k2 => $v2) {
            if ($v1 == $v2) {
                $common++;
            }
        }
    }
    return ($common);
}

function areFriends($a, $b) {
    global $friendmap;
    foreach ($friendmap[$a] as $key => $value) {
        if ($value == $b) {
            return true;
        }
    }
    return false;
}

// foreach ($friendmap as $key => $value) {
//  echo $key . " : " . count($friendmap[$key]) . " ";
//  foreach ($friendmap[$key] as $key2 => $value2) {
//      echo $value2 . " ";
//  }
//  echo "<br>";
// }

foreach ($friendmap as $key1 => $v1) {
    foreach ($friendmap as $key2 => $v2) {
        if ($key1 != $key2) {
            if (!areFriends($key1, $key2)) {
                if (ver($key1, $key2) * 100 >= sizeof($friendmap[$key1]) * $k) {
                    $possibleFriendMap[$key1] = array();
                    array_push($possibleFriendMap[$key1], $key2);
                }
            }
        }
    }
}

ksort($possibleFriendMap);
foreach ($possibleFriendMap as $key => $value) {
    sort($possibleFriendMap[$key]);
}

foreach ($possibleFriendMap as $key => $value) {
    fprintf($fileOUT, $key . ": " . count($possibleFriendMap[$key]) . " ");
    foreach ($possibleFriendMap[$key] as $key2 => $value2) {
        fprintf($fileOUT, $value2 . " ");
    }
    fprintf($fileOUT, "\n");
}

fclose($fileOUT);
fclose($fileIN);
?>

<?PHP
$fileIN = fopen("php://stdin", "r");
$fileOUT = fopen("php://stdout", "w");

$line = explode(" ", trim(fgets($fileIN)));
$n = $line[0];
$k = $line[1];

$friendmap = array();

for ($i = 0; $i < $n; ++$i) {
    $line = explode(" ", trim(fgets($fileIN)));
    if (!isset($friendmap[$line[0]])) {
        $friendmap[$line[0]] = array();
        array_push($friendmap[$line[0]], $line[1]);
    } else {
        array_push($friendmap[$line[0]], $line[1]);
    }
    if (!isset($friendmap[$line[1]])) {
        $friendmap[$line[1]] = array();
        array_push($friendmap[$line[1]], $line[0]);
    } else {
        array_push($friendmap[$line[1]], $line[0]);
    }
}

function ver($a, $b) {
    global $friendmap;
    $common = 0;
    foreach ($friendmap[$a] as $k1 => $v1) {
        foreach ($friendmap[$b] as $k2 => $v2) {
            if ($v1 == $v2) {
                $common++;
            }
        }
    }
    return ($common);
}

function areFriends($a, $b) {
    global $friendmap;
    foreach ($friendmap[$a] as $key => $value) {
        if ($value == $b) {
            return true;
        }
    }
    return false;
}

// foreach ($friendmap as $key => $value) {
//  echo $key . " : " . count($friendmap[$key]) . " ";
//  foreach ($friendmap[$key] as $key2 => $value2) {
//      echo $value2 . " ";
//  }
//  echo "<br>";
// }

$possibleFriendMap = array();

foreach ($friendmap as $key1 => $v1) {
    foreach ($friendmap as $key2 => $v2) {
        if ($key1 != $key2) {
            if (!areFriends($key1, $key2)) {
                if (ver($key1, $key2) * 100 >= sizeof($friendmap[$key1]) * $k) {
                    if (!isset($possibleFriendMap[$key1])) {
                        $possibleFriendMap[$key1] = array();
                        array_push($possibleFriendMap[$key1], $key2);
                    } else {
                        array_push($possibleFriendMap[$key1], $key2);
                    }
                }
            }
        }
    }
}

ksort($possibleFriendMap);
foreach ($possibleFriendMap as $key => $value) {
    sort($possibleFriendMap[$key]);
}

foreach ($possibleFriendMap as $key => $value) {
    fprintf($fileOUT, $key . ": " . count($possibleFriendMap[$key]) . " ");
    foreach ($possibleFriendMap[$key] as $key2 => $value2) {
        fprintf($fileOUT, $value2 . " ");
    }
    fprintf($fileOUT, "\n");
}

fclose($fileOUT);
fclose($fileIN);
?>

<?PHP
$fileIN = fopen("php://stdin", "r");
$fileOUT = fopen("php://stdout", "w");

$line = explode(" ", trim(fgets($fileIN)));
$n = $line[0];
$k = $line[1];

$friendmap = array();

for ($i = 0; $i < $n; ++$i) {
    $line = explode(" ", trim(fgets($fileIN)));
    if (!isset($friendmap[$line[0]])) {
        $friendmap[$line[0]] = array();
        array_push($friendmap[$line[0]], $line[1]);
    } else {
        array_push($friendmap[$line[0]], $line[1]);
    }
    if (!isset($friendmap[$line[1]])) {
        $friendmap[$line[1]] = array();
        array_push($friendmap[$line[1]], $line[0]);
    } else {
        array_push($friendmap[$line[1]], $line[0]);
    }
}

function ver($a, $b) {
    global $friendmap;
    $common = 0;
    foreach ($friendmap[$a] as $k1 => $v1) {
        foreach ($friendmap[$b] as $k2 => $v2) {
            if ($v1 == $v2) {
                $common++;
            }
        }
    }
    return ($common);
}

function areFriends($a, $b) {
    global $friendmap;
    foreach ($friendmap[$a] as $key => $value) {
        if ($value == $b) {
            return true;
        }
    }
    return false;
}

// foreach ($friendmap as $key => $value) {
//  echo $key . " : " . count($friendmap[$key]) . " ";
//  foreach ($friendmap[$key] as $key2 => $value2) {
//      echo $value2 . " ";
//  }
//  echo "<br>";
// }

$possibleFriendMap = array();

foreach ($friendmap as $key1 => $v1) {
    foreach ($friendmap as $key2 => $v2) {
        if ($key1 != $key2) {
            if (!areFriends($key1, $key2)) {
                if (ver($key1, $key2) * 100 >= sizeof($friendmap[$key1]) * $k) {
                    if (!isset($possibleFriendMap[$key1])) {
                        $possibleFriendMap[$key1] = array();
                        array_push($possibleFriendMap[$key1], $key2);
                    } else {
                        array_push($possibleFriendMap[$key1], $key2);
                    }
                }
            }
        }
    }
}

foreach ($possibleFriendMap as $key => $value) {
    fprintf($fileOUT, $key . ": " . count($possibleFriendMap[$key]) . " ");
    foreach ($possibleFriendMap[$key] as $key2 => $value2) {
        fprintf($fileOUT, $value2 . " ");
    }
    fprintf($fileOUT, "\n");
}

fclose($fileOUT);
fclose($fileIN);
?>

<?PHP
$fileIN = fopen("php://stdin", "r");
$fileOUT = fopen("php://stdout", "w");

$line = explode(" ", trim(fgets($fileIN)));
$n = $line[0];
$k = $line[1];

$friendmap = array();
$possibleFriendMap = array();

for ($i = 0; $i < $n; ++$i) {
    $line = explode(" ", trim(fgets($fileIN)));
    if (!isset($friendmap[$line[0]])) {
        $friendmap[$line[0]] = array();
        $possibleFriendMap[$line[0]] = array();
        array_push($friendmap[$line[0]], $line[1]);
    } else {
        array_push($friendmap[$line[0]], $line[1]);
    }
    if (!isset($friendmap[$line[1]])) {
        $friendmap[$line[1]] = array();
        $possibleFriendMap[$line[1]] = array();
        array_push($friendmap[$line[1]], $line[0]);
    } else {
        array_push($friendmap[$line[1]], $line[0]);
    }
}

function ver($a, $b) {
    global $friendmap;
    $common = 0;
    foreach ($friendmap[$a] as $k1 => $v1) {
        foreach ($friendmap[$b] as $k2 => $v2) {
            if ($v1 == $v2) {
                $common++;
            }
        }
    }
    return ($common);
}

function areFriends($a, $b) {
    global $friendmap;
    foreach ($friendmap[$a] as $key => $value) {
        if ($value == $b) {
            return true;
        }
    }
    return false;
}

// foreach ($friendmap as $key => $value) {
//  echo $key . " : " . count($friendmap[$key]) . " ";
//  foreach ($friendmap[$key] as $key2 => $value2) {
//      echo $value2 . " ";
//  }
//  echo "<br>";
// }

foreach ($friendmap as $key1 => $v1) {
    foreach ($friendmap as $key2 => $v2) {
        if ($key1 != $key2) {
            if (!areFriends($key1, $key2)) {
                if (ver($key1, $key2) * 100 >= sizeof($friendmap[$key1]) * $k) {
                    $possibleFriendMap[$key1] = array();
                    array_push($possibleFriendMap[$key1], $key2);
                }
            }
        }
    }
}

ksort($possibleFriendMap);
foreach ($possibleFriendMap as $key => $value) {
    sort($possibleFriendMap[$key]);
}

foreach ($possibleFriendMap as $key => $value) {
    fprintf($fileOUT, $key . ": " . count($possibleFriendMap[$key]) . " ");
    foreach ($possibleFriendMap[$key] as $key2 => $value2) {
        fprintf($fileOUT, $value2 . " ");
    }
    fprintf($fileOUT, "\n");
}

fclose($fileOUT);
fclose($fileIN);
?>

<?PHP
$fileIN = fopen("in.txt", "r");
$fileOUT = fopen("out.txt", "w");

$line = explode(" ", trim(fgets($fileIN)));
$n = $line[0];
$k = $line[1];

$friendmap = array();
$possibleFriendMap = array();

for ($i = 0; $i < $n; ++$i) {
    $line = explode(" ", trim(fgets($fileIN)));
    if (!isset($friendmap[$line[0]])) {
        $friendmap[$line[0]] = array();
        array_push($friendmap[$line[0]], $line[1]);
    } else {
        array_push($friendmap[$line[0]], $line[1]);
    }
    if (!isset($friendmap[$line[1]])) {
        $friendmap[$line[1]] = array();
        array_push($friendmap[$line[1]], $line[0]);
    } else {
        array_push($friendmap[$line[1]], $line[0]);
    }
}

function ver($a, $b) {
    global $friendmap;
    $common = 0;
    foreach ($friendmap[$a] as $k1 => $v1) {
        foreach ($friendmap[$b] as $k2 => $v2) {
            if ($v1 == $v2) {
                $common++;
            }
        }
    }
    return ($common);
}

function areFriends($a, $b) {
    global $friendmap;
    foreach ($friendmap[$a] as $key => $value) {
        if ($value == $b) {
            return true;
        }
    }
    return false;
}

// foreach ($friendmap as $key => $value) {
//  echo $key . " : " . count($friendmap[$key]) . " ";
//  foreach ($friendmap[$key] as $key2 => $value2) {
//      echo $value2 . " ";
//  }
//  echo "<br>";
// }

foreach ($friendmap as $key1 => $v1) {
    foreach ($friendmap as $key2 => $v2) {
        if ($key1 != $key2) {
            if (!isset($possibleFriendMap[$key1])) {
                $possibleFriendMap[$key1] = array();
            }
            if (!isset($possibleFriendMap[$key2])) {
                $possibleFriendMap[$key2] = array();
            }
            if (!areFriends($key1, $key2)) {
                if (ver($key1, $key2) * 100 >= sizeof($friendmap[$key1]) * $k) {
                    array_push($possibleFriendMap[$key1], $key2);
                }
            }
        }
    }
}

ksort($possibleFriendMap);
foreach ($possibleFriendMap as $key => $value) {
    sort($possibleFriendMap[$key]);
}

foreach ($possibleFriendMap as $key => $value) {
    fprintf($fileOUT, $key . ": " . count($possibleFriendMap[$key]) . " ");
    foreach ($possibleFriendMap[$key] as $key2 => $value2) {
        fprintf($fileOUT, $value2 . " ");
    }
    fprintf($fileOUT, "\n");
}

fclose($fileOUT);
fclose($fileIN);
?>

<?PHP
$fileIN = fopen("php://stdin", "r");
$fileOUT = fopen("php://stdout", "w");

$line = explode(" ", trim(fgets($fileIN)));
$n = $line[0];
$k = $line[1];

$friendmap = array();

for ($i = 0; $i < $n; ++$i) {
    $line = explode(" ", trim(fgets($fileIN)));
    if (!isset($friendmap[$line[0]])) {
        $friendmap[$line[0]] = array();
        array_push($friendmap[$line[0]], $line[1]);
    } else {
        array_push($friendmap[$line[0]], $line[1]);
    }
    if (!isset($friendmap[$line[1]])) {
        $friendmap[$line[1]] = array();
        array_push($friendmap[$line[1]], $line[0]);
    } else {
        array_push($friendmap[$line[1]], $line[0]);
    }
}

function ver($a, $b) {
    global $friendmap;
    $common = 0;
    foreach ($friendmap[$a] as $k1 => $v1) {
        foreach ($friendmap[$b] as $k2 => $v2) {
            if ($v1 == $v2) {
                $common++;
            }
        }
    }
    return ($common);
}

function areFriends($a, $b) {
    global $friendmap;
    foreach ($friendmap[$a] as $key => $value) {
        if ($value == $b) {
            return true;
        }
    }
    return false;
}

// foreach ($friendmap as $key => $value) {
//  echo $key . " : " . count($friendmap[$key]) . " ";
//  foreach ($friendmap[$key] as $key2 => $value2) {
//      echo $value2 . " ";
//  }
//  echo "<br>";
// }

$possibleFriendMap = array();

foreach ($friendmap as $key1 => $v1) {
    foreach ($friendmap as $key2 => $v2) {
        if ($key1 != $key2) {
            if (!areFriends($key1, $key2)) {
                if (ver($key1, $key2) * 100 >= sizeof($friendmap[$key1]) * $k) {
                    if (!isset($possibleFriendMap[$key1])) {
                        $possibleFriendMap[$key1] = array();
                        array_push($possibleFriendMap[$key1], $key2);
                    } else {
                        array_push($possibleFriendMap[$key1], $key2);
                    }
                }
            }
        }
    }
}

foreach ($possibleFriendMap as $key => $value) {
    fprintf($fileOUT, $key . " : " . count($possibleFriendMap[$key]) . " ");
    foreach ($possibleFriendMap[$key] as $key2 => $value2) {
        fprintf($fileOUT, $value2 . " ");
    }
    fprintf($fileOUT, "\n");
}

fclose($fileOUT);
fclose($fileIN);
?>

<?PHP
$fileIN = fopen("php://stdin", "r");
$fileOUT = fopen("php://stdout", "w");

$line = explode(" ", trim(fgets($fileIN)));
$n = $line[0];
$k = $line[1];

$friendmap = array();
$possibleFriendMap = array();

for ($i = 0; $i < $n; ++$i) {
    $line = explode(" ", trim(fgets($fileIN)));
    if (!isset($friendmap[$line[0]])) {
        $friendmap[$line[0]] = array();
        array_push($friendmap[$line[0]], $line[1]);
    } else {
        array_push($friendmap[$line[0]], $line[1]);
    }
    if (!isset($friendmap[$line[1]])) {
        $friendmap[$line[1]] = array();
        array_push($friendmap[$line[1]], $line[0]);
    } else {
        array_push($friendmap[$line[1]], $line[0]);
    }
}

function ver($a, $b) {
    global $friendmap;
    $common = 0;
    foreach ($friendmap[$a] as $k1 => $v1) {
        foreach ($friendmap[$b] as $k2 => $v2) {
            if ($v1 == $v2) {
                $common++;
            }
        }
    }
    return ($common);
}

function areFriends($a, $b) {
    global $friendmap;
    foreach ($friendmap[$a] as $key => $value) {
        if ($value == $b) {
            return true;
        }
    }
    return false;
}

// foreach ($friendmap as $key => $value) {
//  echo $key . " : " . count($friendmap[$key]) . " ";
//  foreach ($friendmap[$key] as $key2 => $value2) {
//      echo $value2 . " ";
//  }
//  echo "<br>";
// }

foreach ($friendmap as $key1 => $v1) {
    foreach ($friendmap as $key2 => $v2) {
        if ($key1 != $key2) {
            if (!isset($possibleFriendMap[$key1])) {
                $possibleFriendMap[$key1] = array();
            }
            if (!isset($possibleFriendMap[$key2])) {
                $possibleFriendMap[$key2] = array();
            }
            if (!areFriends($key1, $key2)) {
                if (ver($key1, $key2) * 100 >= sizeof($friendmap[$key1]) * $k) {
                    $possibleFriendMap[$key1] = array();
                    array_push($possibleFriendMap[$key1], $key2);
                }
            }
        }
    }
}

ksort($possibleFriendMap);
foreach ($possibleFriendMap as $key => $value) {
    sort($possibleFriendMap[$key]);
}

foreach ($possibleFriendMap as $key => $value) {
    fprintf($fileOUT, $key . ": " . count($possibleFriendMap[$key]) . " ");
    foreach ($possibleFriendMap[$key] as $key2 => $value2) {
        fprintf($fileOUT, $value2 . " ");
    }
    fprintf($fileOUT, "\n");
}

fclose($fileOUT);
fclose($fileIN);
?>


<?php
    $a = trim(fgets(STDIN));
    $b = explode(' ',trim(fgets(STDIN)));
   // $ball=explode(' ',trim(fgets(STDIN)));
  asort($b); $count=$b[0];  $k=1;
  foreach ($b as $key=>$value)
  {

      print(($key+1)." ");
  }

?>

<?php
class Stream {

    const STDIN = 'php://stdin';
    const STDOUT = 'php://stdout';

    const READ = 'r';
    const WRITE = 'w';

    const SPACE = " ";
    const ENDL = "\n";

    protected $stream;

    public function __construct($file, $mode) {
        $this->stream = fopen($file, $mode);
    }

    public function __destruct() {
        fclose($this->stream);
    }

}

class InputStream extends Stream {

    private $buffer = array();

    public function __construct($file = self::STDIN) {
        parent::__construct($file, self::READ);
    }

    private function update() {
        $content = stream_get_contents($this->stream);
        $buffer = explode(self::ENDL, $content);
        foreach ($buffer as $k => $v) {
            $buffer[$k] = strtr($v, array("\n", "\r"), "");
            $buffer[$k] = explode(self::SPACE, $buffer[$k]);
        }
        $this->buffer = array_merge($this->buffer, $buffer);
    }

    public function read() {
        $this->update();
        if (count($this->buffer) <= 0) {
            $buf = NULL;
        } else {
            $buf = array_shift($this->buffer[0]);
            if (count($this->buffer[0]) <= 0) {
                array_shift($this->buffer);
            }
        }
        return $buf;
    }

    public function readLine() {
        $this->update();
        if (count($this->buffer) <= 0) {
            $buf = NULL;
        } else {
            $buf = implode(self::SPACE, $this->buffer[0]);
            array_shift($this->buffer);
        }
        return $buf;
    }

}

class OutputStream extends Stream {

    private $buffer = array();

    public function __construct($file = self::STDOUT) {
        parent::__construct($file, self::WRITE);
    }

    public function flush() {
        fwrite($this->stream, implode($this->buffer));
        $this->buffer = array();
    }

    public function write($var) {
        array_push($this->buffer, $var);
    }

    public function __destruct() {
        $this->flush();
        parent::__destruct();
    }

}

global $stdin, $stdout;

$stdin = new InputStream();
$stdout = new OutputStream();

/* Program Code */
$n = 0; $a = array(); $p = array();

$n = $stdin->read();
for ($i = 1; $i <= $n; $i++) {
    $p[$i] = (int) $stdin->read();
    $a[$p[$i]] = $i;
}

for ($i = 1; $i <= $n; $i++) {
    $stdout->write($a[$i] . " ");
}
?>

<?php
fscanf(STDIN, '%d', $n);
$in = explode(' ', fgets(STDIN));

$arr = array();
for ($i = 0; $i < $n; $i++) {
    $arr[$in[$i]] = $i + 1;
}

ksort($arr);
foreach($arr as $elem) {
    echo $elem.' ';
}

<?php

/**
 * @author: Sunwarul Islam, Bangladesh
 * Php 7.2
 */

$n = (int) fgets(STDIN);
$myarr = array_map('intval', preg_split('/ /', fgets(STDIN)));
$new_arr = [];

for ($i = 0; $i < count($myarr); $i++) {
    $new_arr[$myarr[$i] - 1] = $i + 1;
}

for ($i = 0; $i < count($new_arr); $i++) {
    echo $new_arr[$i] . " ";
}
echo "\n";

<?
$n=fgets(STDIN);
$m=explode(" ",fgets(STDIN));
foreach($m as $k => $v)$x[$v]=$k+1;
ksort($x);
foreach($x as $xv)echo $xv." ";

?>

<?php

$n = trim(fgets(STDIN));
$a = explode(' ',trim(fgets(STDIN)));

for($i=1;$i<=$n;$i++) print (array_search($i,$a)+1).' ';

?>

<?
$fp=fopen('php://stdin', 'r');
$lines=stream_get_contents($fp);
$lines=trim($lines);
$lines=explode("\n", $lines);

$arr=array();
$ps=explode(" ", trim($lines[1]));
foreach ($ps as $from=>$to)
    $arr[$from+1]=$to;

foreach($arr as $from=>$to)
    $res[]=array_search($from, $arr);
echo implode(" ", $res);

?>

<?php

while (fscanf(STDIN, "%d", $people_num)){
    $gifts = stream_get_line(STDIN, 65535, "\n");
    $person_gift = array();
    $person_gift = explode(' ', $gifts);

    $person_gift = array_flip($person_gift);
    ksort($person_gift);

    $i = 1;
    foreach ($person_gift as $key => $value){
        echo $value + 1;
        if ($i == $people_num){
            echo "\n";
        } else {
            echo ' ';
        }
        ++$i;
    }
}

<?php
error_reporting("off");
//136A: Presents
$n = trim(fgets(STDIN)); //$n = 4;
$parray = explode(" ", trim(fgets(STDIN))); //$parray = explode(" ", "4 2 1 5 3");
$startatone = array();
foreach ($parray as $key => $value) {
    $startatone[$key+1] = $value;
}
$gaveto = array();
foreach ($startatone as $key => $value) {
    $gaveto[$value] = $key;
}
ksort($gaveto);
$implode = implode(" ", $gaveto);
echo $implode;
?>

<?php
$a = trim(fgets(STDIN));
$b = explode(" ", trim(fgets(STDIN)));
array_unshift($b, " ");
unset($b[0]);
$c = array();
array_unshift($c, " ");
unset($c[0]);
$d = array();
array_unshift($d, " ");
unset($d[0]);
$e = array();
for($x = 1; $x <= $a; $x++)
{
    array_push($c, $x);
    array_push($d, $b[$x]);
}
for($x = 1; $x <= $a; $x++)
{
    $f = array_search($x, $d);
    array_push($e, $c[$f]);
}
print implode(" ", $e);
?>

<?php
$n=trim(fgets(STDIN));
$p=explode(" ", trim(fgets(STDIN)));

for ($i=1; $i <=$n ; $i++) {
	echo array_search($i, $p)+1 . " ";
}

?>

<?php
function input()
{
    while (($line = fgets(STDIN)) != PHP_EOL) {
        yield $line;
    }
}

$COUNT = 0;
foreach (input() as $line) {
    if ($COUNT == 0) {
        $n = intval($line);
        ++$COUNT;
        continue;
    }
    $p = explode(' ', $line);
    // print_r($p);
    $r = array(count($p));
    for($i=0; $i<$n; ++$i) {
        $r[intval($p[$i])-1] = $i+1;
    }

    for($i=0; $i<$n; ++$i) {
        echo $r[$i] . " ";
    }
    // echo $x;

    if (++$COUNT > 1) {
        break;
    }
}

<?php
$n = (int) readline();
$nums = array_map('intval', explode(' ', readline()));
$result = array();
foreach($nums as $key => $num){
    $result[$num] = $key+1;
}

for($i=1; $i<=$n;$i++){
    echo $result[$i] . " ";
}

<?php

fscanf(STDIN, '%d', $number);
$guests = explode(" ", trim(fgets(STDIN)));
$str = '';
for ($i = 1; $i <= $number; $i++) {
    $str .= (array_search($i, $guests) + 1) . " ";
}

print(trim($str, ' '));

<?php
fscanf(STDIN,"%d",$n);
$line=trim(fgets(STDIN));
$singleValue=explode(' ',$line);

$saveToAnother=$singleValue;

for($i=0;$i<$n;$i++)
{
	for($j=0;$j<$n-1;$j++)
	{
		if($saveToAnother[$i]<$saveToAnother[$j])
		{
			$saveToAnother[$i]=$saveToAnother[$i]+$saveToAnother[$j];
			$saveToAnother[$j]=$saveToAnother[$i]-$saveToAnother[$j];
			$saveToAnother[$i]=$saveToAnother[$i]-$saveToAnother[$j];
		}
	}
}
for($i=0;$i<$n;$i++)
$store[$i]=array_keys($singleValue,$saveToAnother[$i]);

for($i=0;$i<$n-1;$i++){
$str[$i]=$store[$i][0]+1;
echo "$str[$i] ";
}
echo $store[$n-1][0]+1;

<?php
$f = fopen('php://stdin', 'r');
//$f = fopen('test.txt', 'r');

$n = trim(fgets($f));
$s = trim(fgets($f));

$a = explode(" ",$s);

$b = array();
foreach($a as $k=>$x){
    $b[$x] = $k+1;
}
ksort($b);

echo(implode(" ",$b));

<?php

$stdout = fopen(getenv("OUTPUT_PATH"), "w");
$stdin = fopen("php://stdin", "r");

fscanf( $stdin , "%d" , $t ) ;

fscanf( $stdin , "%[^\n]" , $test ) ;

$numbers = array_map( 'intval' , preg_split('/ /' , $test , -1 , PREG_SPLIT_NO_EMPTY ) );

$arr = [] ;

for( $i=0 ; $i<$t ; $i++)
{
     $x = $numbers[$i] ;
     $arr[ $numbers[$x-1] ] = $x ;
}
for( $i=1 ; $i<=$t ; $i++)
{
     echo $arr[$i] . " " ;
}

fwrite($stdout);

fclose($stdin);
fclose($stdout);

?>

<?php
$n = trim(fgets(STDIN));
$a = explode(" ", trim(fgets(STDIN)));

for ($i=1;$i<=$n;$i++){
	echo array_search($i, $a)+1 . " ";
}
?>

<?php
$fr = trim(fgets(STDIN));
$nfr = explode(' ', trim(fgets(STDIN)));
$array = array();
foreach ($nfr as $k => $v)
{
    $array[$k + 1] = $v;
}
foreach ($array as $k => $v)
{
    $mas[] = array_search($k, $array);
}

echo implode(' ', $mas);

?>

<?php
$input = explode("\n", trim(file_get_contents("php://stdin")));
unset($input[0]);
$prs = explode(' ',$input[1]);
$ipr = array();
foreach($prs as $pr => $fr){
    $ipr[--$fr] = ++$pr;
}
ksort($ipr);
echo implode(' ', $ipr);

<?php
// 136A Подарки

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

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

$out = '';

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

$arr = array_flip ( $arr );

ksort($arr);

foreach ($arr as $key => $value) {
    $x = $value + 1;
    $out .= "$x ";
}

echo $out;

?>

<?php
$n = fgets(STDIN);
$no=array();
$friend = explode(" ",fgets(STDIN));
for ($i=0;$i<$n;$i++)
{
    $no[$friend[$i]-1] = $i;
}
var_dump($no);
for ($i=0;$i<$n;$i++)
{
    echo $no[$i]+1;
}

<?php
$n = fgets(STDIN);
$friend = explode(" ",fgets(STDIN));
for ($i=0;$i<$n;$i++)
{
    echo $friend[$friend[$i]%4]." ";
}

<?php
$n = fgets(STDIN);
$friend = explode(" ",fgets(STDIN));
for ($i=0;$i<$n;$i++)
{
    echo $friend[$friend[$i]%$n]." ";
}

<?php
class Stream {

    const STDIN = 'php://stdin';
    const STDOUT = 'php://stdout';

    const READ = 'r';
    const WRITE = 'w';

    const SPACE = " ";
    const ENDL = "\n";

    protected $stream;

    public function __construct($file, $mode) {
        $this->stream = fopen($file, $mode);
    }

    public function __destruct() {
        fclose($this->stream);
    }

}

class InputStream extends Stream {

    private $buffer = array();

    public function __construct($file = self::STDIN) {
        parent::__construct($file, self::READ);
    }

    private function update() {
        $content = stream_get_contents($this->stream);
        $buffer = explode(self::ENDL, $content);
        foreach ($buffer as $k => $v) {
            $buffer[$k] = explode(self::SPACE, $v);
        }
        $this->buffer = array_merge($this->buffer, $buffer);
    }

    public function read() {
        $this->update();
        if (count($this->buffer) <= 0) {
            $buf = NULL;
        } else {
            $buf = array_shift($this->buffer[0]);
            if (count($this->buffer[0]) <= 0) {
                array_shift($this->buffer);
            }
        }
        return $buf;
    }

    public function readLine() {
        $this->update();
        if (count($this->buffer) <= 0) {
            $buf = NULL;
        } else {
            $buf = implode(self::SPACE, $this->buffer[0]);
            array_shift($this->buffer);
        }
        return $buf;
    }

}

class OutputStream extends Stream {

    private $buffer = array();

    public function __construct($file = self::STDOUT) {
        parent::__construct($file, self::WRITE);
    }

    public function flush() {
        fwrite($this->stream, implode($this->buffer));
        $this->buffer = array();
    }

    public function write($var) {
        array_push($this->buffer, $var);
    }

    public function __destruct() {
        $this->flush();
        parent::__destruct();
    }

}

global $stdin, $stdout;

$stdin = new InputStream();
$stdout = new OutputStream();

/* Program Code */
$n = 0; $a = array(); $p = array();

$n = $stdin->read();
for ($i = 1; $i <= $n; $i++) {
    $p[$i] = $stdin->read();
    $a[$p[$i]] = $i;
}

for ($i = 1; $i <= $n; $i++) {
    $stdout->write($a[$i] . " ");
}
?>

<?php
class Stream {

    const STDIN = 'php://stdin';
    const STDOUT = 'php://stdout';

    const READ = 'r';
    const WRITE = 'w';

    const SPACE = " ";
    const ENDL = "\n";

    protected $stream;

    public function __construct($file, $mode) {
        $this->stream = fopen($file, $mode);
    }

    public function __destruct() {
        fclose($this->stream);
    }

}

class InputStream extends Stream {

    private $buffer = array();

    public function __construct($file = self::STDIN) {
        parent::__construct($file, self::READ);
    }

    private function update() {
        $content = stream_get_contents($this->stream);
        $content = strtr($content, "\r", "");
        $buffer = explode(self::ENDL, $content);
        foreach ($buffer as $k => $v) {
            $buffer[$k] = explode(self::SPACE, $v);
        }
        $this->buffer = array_merge($this->buffer, $buffer);
    }

    public function read() {
        $this->update();
        if (count($this->buffer) <= 0) {
            $buf = NULL;
        } else {
            $buf = array_shift($this->buffer[0]);
            if (count($this->buffer[0]) <= 0) {
                array_shift($this->buffer);
            }
        }
        return $buf;
    }

    public function readLine() {
        $this->update();
        if (count($this->buffer) <= 0) {
            $buf = NULL;
        } else {
            $buf = implode(self::SPACE, $this->buffer[0]);
            array_shift($this->buffer);
        }
        return $buf;
    }

}

class OutputStream extends Stream {

    private $buffer = array();

    public function __construct($file = self::STDOUT) {
        parent::__construct($file, self::WRITE);
    }

    public function flush() {
        fwrite($this->stream, implode($this->buffer));
        $this->buffer = array();
    }

    public function write($var) {
        array_push($this->buffer, $var);
    }

    public function __destruct() {
        $this->flush();
        parent::__destruct();
    }

}

global $stdin, $stdout;

$stdin = new InputStream();
$stdout = new OutputStream();

/* Program Code */
$n = 0; $a = array(); $p = array();

$n = $stdin->read();
for ($i = 1; $i <= $n; $i++) {
    $p[$i] = $stdin->read();
    $a[$p[$i]] = $i;
}

for ($i = 1; $i <= $n; $i++) {
    $stdout->write($a[$i] . " ");
}
?>

<?php
$n = trim(fgets(STDIN));
$a = explode(' ',trim(fgets(STDIN)));
for($i=2;$i<=$n;$i++) print (array_search($i,$a)+1).' ';
?>

<?php
class Stream {

	const STDIN = 'php://stdin';
	const STDOUT = 'php://stdout';

	const READ = 'r';
	const WRITE = 'w';

	const SPACE = " ";
	const ENDL = "\n";

	protected $stream;

	public function __construct($file, $mode) {
		$this->stream = fopen($file, $mode);
	}

	public function __destruct() {
		fclose($this->stream);
	}

}

class InputStream extends Stream {

	private $buffer = array();

	public function __construct($file = self::STDIN) {
		parent::__construct($file, self::READ);
	}

	private function update() {
		$content = stream_get_contents($this->stream);
		$buffer = explode(self::ENDL, $content);
		foreach ($buffer as $k => $v) {
			$buffer[$k] = strtr($v, array("\n", "\r"), "");
			$buffer[$k] = explode(self::SPACE, $buffer[$k]);
		}
		$this->buffer = array_merge($this->buffer, $buffer);
	}

	public function read() {
		$this->update();
		if (count($this->buffer) <= 0) {
			$buf = NULL;
		} else {
			$buf = array_shift($this->buffer[0]);
			if (count($this->buffer[0]) <= 0) {
				array_shift($this->buffer);
			}
		}
		return $buf;
	}

	public function readLine() {
		$this->update();
		if (count($this->buffer) <= 0) {
			$buf = NULL;
		} else {
			$buf = implode(self::SPACE, $this->buffer[0]);
			array_shift($this->buffer);
		}
		return $buf;
	}

}

class OutputStream extends Stream {

	private $buffer = array();

	public function __construct($file = self::STDOUT) {
		parent::__construct($file, self::WRITE);
	}

	public function flush() {
		fwrite($this->stream, implode($this->buffer));
		$this->buffer = array();
	}

	public function write($var) {
		array_push($this->buffer, $var);
	}

	public function __destruct() {
		$this->flush();
		parent::__destruct();
	}

}

global $stdin, $stdout;

$stdin = new InputStream();
$stdout = new OutputStream();

/* Program Code */
$n = 0; $a = array(); $p = array();

$n = $stdin->read();
for ($i = 1; $i <= $n; $i++) {
	$p[$i] = $stdin->read();
	$a[$p[$i]] = $i;
}

for ($i = 1; $i <= $n; $i++) {
	$stdout->write($a[$i] . " ");
}
?>

<?php
class Stream {

    const STDIN = 'php://stdin';
    const STDOUT = 'php://stdout';

    const READ = 'r';
    const WRITE = 'w';

    const SPACE = " ";
    const ENDL = "\n";

    protected $stream;

    public function __construct($file, $mode) {
        $this->stream = fopen($file, $mode);
    }

    public function __destruct() {
        fclose($this->stream);
    }

}

class InputStream extends Stream {

    private $buffer = array();

    public function __construct($file = self::STDIN) {
        parent::__construct($file, self::READ);
    }

    private function update() {
        $content = stream_get_contents($this->stream);
        $buffer = explode(self::ENDL, $content);
        var_dump($buffer);
        foreach ($buffer as $k => $v) {
            $buffer[$k] = strtr($v, array("\n", "\r"), "");
            $buffer[$k] = explode(self::SPACE, $buffer[$k]);
        }
        $this->buffer = array_merge($this->buffer, $buffer);
    }

    public function read() {
        $this->update();
        if (count($this->buffer) <= 0) {
            $buf = NULL;
        } else {
            $buf = array_shift($this->buffer[0]);
            if (count($this->buffer[0]) <= 0) {
                array_shift($this->buffer);
            }
        }
        return $buf;
    }

    public function readLine() {
        $this->update();
        if (count($this->buffer) <= 0) {
            $buf = NULL;
        } else {
            $buf = implode(self::SPACE, $this->buffer[0]);
            array_shift($this->buffer);
        }
        return $buf;
    }

}

class OutputStream extends Stream {

    private $buffer = array();

    public function __construct($file = self::STDOUT) {
        parent::__construct($file, self::WRITE);
    }

    public function flush() {
        fwrite($this->stream, implode($this->buffer));
        $this->buffer = array();
    }

    public function write($var) {
        array_push($this->buffer, $var);
    }

    public function __destruct() {
        $this->flush();
        parent::__destruct();
    }

}

global $stdin, $stdout;

$stdin = new InputStream();
$stdout = new OutputStream();

/* Program Code */
$n = 0; $a = array(); $p = array();

$n = $stdin->read();
for ($i = 1; $i <= $n; $i++) {
    $p[$i] = $stdin->read();
    $stdout->write($p[$i] . " ");
    $a[$p[$i]] = $i;
}

for ($i = 1; $i <= $n; $i++) {
    $stdout->write($a[$i] . " ");
}
?>

<?php
class Stream {

	const STDIN = 'php://stdin';
	const STDOUT = 'php://stdout';

	const READ = 'r';
	const WRITE = 'w';

	const SPACE = " ";
	const ENDL = "\n";

	protected $stream;

	public function __construct($file, $mode) {
		$this->stream = fopen($file, $mode);
	}

	public function __destruct() {
		fclose($this->stream);
	}

}

class InputStream extends Stream {

	private $buffer = array();

	public function __construct($file = self::STDIN) {
		parent::__construct($file, self::READ);
	}

	private function update() {
		$content = stream_get_contents($this->stream);
		$buffer = explode(self::ENDL, $content);
		var_dump($buffer);
		foreach ($buffer as $k => $v) {
			$buffer[$k] = strtr($v, array("\n", "\r"), "");
			$buffer[$k] = explode(self::SPACE, $buffer[$k]);
		}
		$this->buffer = array_merge($this->buffer, $buffer);
	}

	public function read() {
		$this->update();
		if (count($this->buffer) <= 0) {
			$buf = NULL;
		} else {
			$buf = array_shift($this->buffer[0]);
			if (count($this->buffer[0]) <= 0) {
				array_shift($this->buffer);
			}
		}
		return $buf;
	}

	public function readLine() {
		$this->update();
		if (count($this->buffer) <= 0) {
			$buf = NULL;
		} else {
			$buf = implode(self::SPACE, $this->buffer[0]);
			array_shift($this->buffer);
		}
		return $buf;
	}

}

class OutputStream extends Stream {

	private $buffer = array();

	public function __construct($file = self::STDOUT) {
		parent::__construct($file, self::WRITE);
	}

	public function flush() {
		fwrite($this->stream, implode($this->buffer));
		$this->buffer = array();
	}

	public function write($var) {
		array_push($this->buffer, $var);
	}

	public function __destruct() {
		$this->flush();
		parent::__destruct();
	}

}

global $stdin, $stdout;

$stdin = new InputStream();
$stdout = new OutputStream();

/* Program Code */
$n = 0; $a = array(); $p = array();

$n = $stdin->read();
for ($i = 1; $i <= $n; $i++) {
	$p[$i] = $stdin->read();
	$a[$p[$i]] = $i;
}

for ($i = 1; $i <= $n; $i++) {
	$stdout->write($a[$i] . " ");
}
?>

<?php
class Stream {

    const STDIN = 'php://stdin';
    const STDOUT = 'php://stdout';

    const READ = 'r';
    const WRITE = 'w';

    const SPACE = " ";
    const ENDL = "\n";

    protected $stream;

    public function __construct($file, $mode) {
        $this->stream = fopen($file, $mode);
    }

    public function __destruct() {
        fclose($this->stream);
    }

}

class InputStream extends Stream {

    private $buffer = array();

    public function __construct($file = self::STDIN) {
        parent::__construct($file, self::READ);
    }

    private function update() {
        $content = stream_get_contents($this->stream);
        $buffer = explode(self::ENDL, $content);
        var_dump($buffer);
        foreach ($buffer as $k => $v) {
            $buffer[$k] = strtr($v, array("\n", "\r"), "");
            $buffer[$k] = explode(self::SPACE, $buffer[$k]);
        }
        $this->buffer = array_merge($this->buffer, $buffer);
    }

    public function read() {
        $this->update();
        if (count($this->buffer) <= 0) {
            $buf = NULL;
        } else {
            $buf = array_shift($this->buffer[0]);
            if (count($this->buffer[0]) <= 0) {
                array_shift($this->buffer);
            }
        }
        return $buf;
    }

    public function readLine() {
        $this->update();
        if (count($this->buffer) <= 0) {
            $buf = NULL;
        } else {
            $buf = implode(self::SPACE, $this->buffer[0]);
            array_shift($this->buffer);
        }
        return $buf;
    }

}

class OutputStream extends Stream {

    private $buffer = array();

    public function __construct($file = self::STDOUT) {
        parent::__construct($file, self::WRITE);
    }

    public function flush() {
        var_dump($this->buffer);
        fwrite($this->stream, implode($this->buffer));
        $this->buffer = array();
    }

    public function write($var) {
        array_push($this->buffer, $var);
    }

    public function __destruct() {
        $this->flush();
        parent::__destruct();
    }

}

global $stdin, $stdout;

$stdin = new InputStream();
$stdout = new OutputStream();

/* Program Code */
$n = 0; $a = array(); $p = array();

$n = $stdin->read();
for ($i = 1; $i <= $n; $i++) {
    $p[$i] = (int) $stdin->read();
    $stdout->write($p[$i] . " ");
    $a[$p[$i]] = $i;
}

for ($i = 1; $i <= $n; $i++) {
    $stdout->write($a[$i] . " ");
}
?>

<?php
class Stream {

    const STDIN = 'php://stdin';
    const STDOUT = 'php://stdout';

    const READ = 'r';
    const WRITE = 'w';

    const SPACE = " ";
    const ENDL = "\n";

    protected $stream;

    public function __construct($file, $mode) {
        $this->stream = fopen($file, $mode);
    }

    public function __destruct() {
        fclose($this->stream);
    }

}

class InputStream extends Stream {

    private $buffer = array();

    public function __construct($file = self::STDIN) {
        parent::__construct($file, self::READ);
    }

    private function update() {
        $content = stream_get_contents($this->stream);
        $buffer = explode(self::ENDL, $content);
        var_dump($buffer);
        foreach ($buffer as $k => $v) {
            $buffer[$k] = strtr($v, array("\n", "\r"), "");
            $buffer[$k] = explode(self::SPACE, $buffer[$k]);
        }
        $this->buffer = array_merge($this->buffer, $buffer);
    }

    public function read() {
        $this->update();
        if (count($this->buffer) <= 0) {
            $buf = NULL;
        } else {
            $buf = array_shift($this->buffer[0]);
            if (count($this->buffer[0]) <= 0) {
                array_shift($this->buffer);
            }
        }
        return $buf;
    }

    public function readLine() {
        $this->update();
        if (count($this->buffer) <= 0) {
            $buf = NULL;
        } else {
            $buf = implode(self::SPACE, $this->buffer[0]);
            array_shift($this->buffer);
        }
        return $buf;
    }

}

class OutputStream extends Stream {

    private $buffer = array();

    public function __construct($file = self::STDOUT) {
        parent::__construct($file, self::WRITE);
    }

    public function flush() {
        var_dump($this->buffer);
        fwrite($this->stream, implode($this->buffer));
        $this->buffer = array();
    }

    public function write($var) {
        array_push($this->buffer, $var);
    }

    public function __destruct() {
        $this->flush();
        parent::__destruct();
    }

}

global $stdin, $stdout;

$stdin = new InputStream();
$stdout = new OutputStream();

/* Program Code */
$n = 0; $a = array(); $p = array();

$n = $stdin->read();
for ($i = 1; $i <= $n; $i++) {
    $p[$i] = $stdin->read();
    $stdout->write($p[$i] . " ");
    $a[$p[$i]] = $i;
}

for ($i = 1; $i <= $n; $i++) {
    $stdout->write($a[$i] . " ");
}
?>

<?php
////////////////TEST
while (fscanf(STDIN, "%d", $people_num)){
    $gifts = stream_get_line(STDIN, 65535, "\n");
    $person_gift = array();
    $person_gift = explode(' ', $gifts);

    $person_gift = array_flip($person_gift);
    echo $person_gift[0] . ' ' . $person_gift[1] . ' ' . $person_gift[2] . ' ' . $person_gift[3];
//    for ($i = 1; $i <= $people_num; $i++){
//        echo (int)($person_gift[$i] + 1) . ' ';
//        if ($i == $people_num){
//            echo "\n";
//        }
//    }
}

<?php
////////////////TEST
while (fscanf(STDIN, "%d", $people_num)){
    $gifts = stream_get_line(STDIN, 65535, "\n");
    $person_gift = array();
    $person_gift = explode(' ', $gifts);

    $person_gift = array_flip($person_gift);
    echo $person_gift[1] . ' ' . $person_gift[2] . ' ' . $person_gift[3] . ' ' . $person_gift[4];
//    for ($i = 1; $i <= $people_num; $i++){
//        echo (int)($person_gift[$i] + 1) . ' ';
//        if ($i == $people_num){
//            echo "\n";
//        }
//    }
}

<?php

while (fscanf(STDIN, "%d", $people_num)){
    $gifts = stream_get_line(STDIN, 65535, "\n");
    $person_gift = array();
    $person_gift = explode(' ', $gifts);

    $person_gift = array_flip($person_gift);
    for ($i = 1; $i <= $people_num; $i++){
        echo (int)($person_gift[$i] + 1) . ' ';
        if ($i == $people_num){
            echo "\n";
        }
    }
}

<?php

while (fscanf(STDIN, "%d", $people_num)){
    $gifts = stream_get_line(STDIN, 65535, "\n");
    $person_gift = array();
    $person_gift = explode(' ', $gifts);

    $person_gift = array_flip($person_gift);
    for ($i = 1; $i <= $people_num; $i++){
        echo $person_gift[$i] + 1 . ' ';
        if ($i == $people_num){
            echo "\n";
        }
    }
}

<?php
////////////////TEST
while (fscanf(STDIN, "%d", $people_num)){
    $gifts = stream_get_line(STDIN, 65535, "\n");
    $person_gift = array();
    $person_gift = explode(' ', $gifts);

    $person_gift = array_flip($person_gift);
    foreach ($person_gift as $key => $value){
        echo $key . '-' . $value . ';';
    }
//    for ($i = 1; $i <= $people_num; $i++){
//        echo (int)($person_gift[$i] + 1) . ' ';
//        if ($i == $people_num){
//            echo "\n";
//        }
//    }
}

<?php
//136A: Presents
$n = trim(fgets(STDIN));
$parray = explode(" ", trim(fgets(STDIN)));
$startatone = array();
foreach ($parray as $key => $value) {
    $startatone[$key+1] = $value;
}
$gaveto = array();
foreach ($startatone as $key => $value) {
    $gaveto[$value] = $key;
}
$implode = implode(" ", $gaveto);
echo $implode;
?>

<?php
error_reporting("off");
//136A: Presents
$n = trim(fgets(STDIN)); //$n = 4;
$parray = explode(" ", trim(fgets(STDIN))); //$parray = explode(" ", "2 3 4 1");
$startatone = array();
foreach ($parray as $key => $value) {
    $startatone[$key+1] = $value;
}
$gaveto = array();
foreach ($startatone as $key => $value) {
    $gaveto[$value] = $key;
}
ksort($gaveto);
print_r($gaveto);
$implode = implode(" ", $gaveto);
echo $implode;
?>

<?php
//136A: Presents
$n = trim(fgets(STDIN));
$parray = explode(" ", trim(fgets(STDIN)));
$gaveto = array();
foreach ($parray as $value) {
    $gaveto[$value] = $value;
}
$implode = implode(" ", $gaveto);
echo $implode;
?>

<?php
//136A: Presents
$n = trim(fgets(STDIN));
$parray = explode(" ", trim(fgets(STDIN)));
$gaveto = array();
foreach ($parray as $key => $value) {
    $gaveto[$value] = $key;
}
$implode = implode(" ", $gaveto);
echo $implode;
?>


<?php
$dir = fopen("php://stdin", 'r');

$string = stream_get_contents($dir);
$arr = explode (PHP_EOL,$string);
$numOfRequests = $arr[0];

for ($i=1;$i<=$numOfRequests;$i++){
$input1 = explode (' ',$arr[$i]);
    $l1 = $input1[0];
    $r1 = $input1[1];
    $l2 = $input1[2];
    $r2 = $input1[3];
    $trya = min ($l1,$l2);
    if ($trya == $l1) {
        $tryb = $r2;
    } else {
        $tryb = $r1;
    }
    if ($l1 == $trya) {
        echo($trya . " " . $tryb . PHP_EOL);
    } else {
        echo($tryb . " " . $trya . PHP_EOL);
    }
}
?>

<?php
/*****************************************/
class InputReader {protected $_fh;public function __construct($fileHandler = STDIN){$this->_fh = $fileHandler;}
	public function readInt() {$d = trim(fgets($this->_fh));return (int)$d;}
	public function readArrayOfInt($size, $indexFrom = 0) {$a = [];$ind = $indexFrom;foreach (explode(' ', fgets($this->_fh)) as $item) {$a[$ind++] = (int)$item;}return $a;}
	public function readArrayOfString($size, $indexFrom = 0) {$a = [];$ind = $indexFrom;foreach (explode(' ', fgets($this->_fh)) as $item) {$a[$ind++] = $item;}return $a;}
}

class Utils {
	/* Perform action N times. Can return values in array */
	static public function ntimes($n, $func, $returnResults = false) {$a = [];for ($i=1; $i<=$n; $i++) {$result = $func();if ($returnResults) {$a[$i] = $result;}}return $a;}
	/* Integral. Keys preserved. By reference. */
	static public function cumsum(&$a){$sum = 0;foreach($a as $k=>$v) {$a[$k] += $sum;$sum = $a[$k];}}
	/* Difference. Keys preserved. By reference. */
	static public function diff(&$a){$prev = 0;foreach($a as $k=>$v) {$buf=$a[$k];$a[$k]-=$prev;$prev = $buf;}}
	static public function bitCount($n){$cnt = 0;for ($j=$n; $j; $j>>=1){$cnt += $j&1;}return $cnt;}
}

class PrimeUtils {static protected $divisors = [1 => [1=>true],2 => [1=>true, 2=>true],];static protected $primes = [];
	static public function primes($limit){$a = str_repeat(chr(85), ($limit>>3) + 1);$a[0] = chr(83);for ($i=3; $i*$i < $limit; $i+=2) {if (ord($a[$i>>3]) & (1<<($i%8))) {;} else {for ($k=$i; $k*$i<$limit; $k++) {$n = $k*$i;$a[$n>>3] = chr(ord($a[$n>>3]) | (1<<($n%8)));}}}yield 2;for ($i=3; $i<$limit; $i+=2) {if (!(ord($a[$i>>3]) & (1<<($i%8)))) {yield $i;}}}
	static public function divisors($n, $lp = 2) {if (isset(self::$divisors[$n])) {return self::$divisors[$n];}if (empty(self::$primes)) {$primes = [];foreach (self::primes(1e3) as $prime) {$primes[$prime] = $prime;}self::$primes = $primes;}$r = [];foreach (self::$primes as $p) {if ($p>=$lp) {if ($n < $p*$p) {$r = [1=>true, $n=>true];break;} elseif ($n%$p==0) {foreach([1, $p] as $pre) {foreach(self::divisors(intdiv($n,$p), $p) as $nxt=>$v) {$r[$nxt*$pre] = true;}}break;}}}self::$divisors[$n] = $r;return self::$divisors[$n];}
}

/*****************************************/

$ir = new InputReader();

/* TASK */

$q = $ir->readInt();

while ($q--) {
	list($l1, $r1, $l2, $r2) = $ir->readArrayOfInt(4);
	if ($l1!=$r2) {
		echo "$l1 $r2\n";
	} else {
		echo "$r1 $l2\n";
	}
	flush();
}

<?
$stdin = fopen('php://stdin', 'r');
ini_set('display_errors', '1');
function read() {
    return trim(fgets(STDIN));
}
$t1 = microtime(true);
$debag = 0;
/*–––––––––––––––––––––––––––––––––––––––––––––––––––––––*/
$n = read();
$poss = [];
for ($i = 0; $i < $n; $i++) {
    $poss[] = explode(' ', read());
}

for ($i = 0; $i < $n; $i++) {
    if ($poss[$i][0] !== $poss[$i][3]) {
        echo $poss[$i][0].' '.$poss[$i][3]."\n";
    } else {
        echo $poss[$i][1].' '.$poss[$i][2]."\n";
    }
}

/*–––––––––––––––––––––––––––––––––––––––––––––––––––––––*/
if ($debag === 1) {
    echo '<hr>' . round(microtime(true) - $t1, 3) . ' sec';
}

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

$f = fgets($stdin);

while($f = fgets($stdin)){
    $array = explode(' ', $f);
    if ($array[3] > $array[1]) {
        echo $array[0] . ' ' . $array[3] . "\n";
    } else {
        echo $array[2] . ' ' . $array[1] . "\n";
    }
}

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

$f = fgets($stdin);

while($f = fgets($stdin)){
    $array = explode(' ', $f);
    echo $array[0] . ' ' . $array[3] . "\n";
}

<?
$stdin = fopen('php://stdin', 'r');
ini_set('display_errors', '1');
function read() {
    return trim(fgets(STDIN));
}
$t1 = microtime(true);
$debag = 1;
/*–––––––––––––––––––––––––––––––––––––––––––––––––––––––*/
$n = read();
$poss = [];
for ($i = 0; $i < $n; $i++) {
    $poss[] = explode(' ', read());
}

for ($i = 0; $i < $n; $i++) {
    if ($poss[$i][0] !== $poss[$i][3]) {
        echo $poss[$i][0].' '.$poss[$i][3]."\n";
    } else {
        echo $poss[$i][1].' '.$poss[$i][2]."\n";
    }
}

/*–––––––––––––––––––––––––––––––––––––––––––––––––––––––*/
if ($debag === 1) {
    echo '<hr>' . round(microtime(true) - $t1, 3) . ' sec';
}

<?
$stdin = fopen('php://stdin', 'r');
ini_set('display_errors', '1');
function read() {
    return trim(fgets(STDIN));
}
$t1 = microtime(true);
$debag = 0;
/*–––––––––––––––––––––––––––––––––––––––––––––––––––––––*/
$n = read();
$poss = [];
for ($i = 0; $i < $n; $i++) {
    $poss[] = explode(' ', read());
}

for ($i = 0; $i < $n; $i++) {
    echo $poss[$i][0].' '.$poss[$i][3]."\n";
}

/*–––––––––––––––––––––––––––––––––––––––––––––––––––––––*/
if ($debag === 1) {
    echo '<hr>' . round(microtime(true) - $t1, 3) . ' sec';
}

<?php
$dir = fopen("php://stdin", 'r');

$string = stream_get_contents($dir);
$arr = explode (PHP_EOL,$string);
$numOfRequests = $arr[0];

for ($i=1;$i<=$numOfRequests;$i++){
$input1 = explode (' ',$arr[$i]);
    $l1 = $input1[0];
    $r1 = $input1[1];
    $l2 = $input1[2];
    $r2 = $input1[3];
    $trya = min ($l1,$l2);
    if ($trya = $l1) {
        $tryb = $r2;
    } else {
        $tryb = $r1;
    }
    if ($l1 = $trya) {
        echo($trya . " " . $tryb . PHP_EOL);
    } else {
        echo($tryb . " " . $trya . PHP_EOL);
    }
}
?>

<?php
$dir = fopen("php://stdin", 'r');

$string = stream_get_contents($dir);
$arr = explode (PHP_EOL,$string);
$numOfRequests = $arr[0];
echo $arr[0];

for ($i=1;$i<=$numOfRequests;$i++){
$input1 = explode (' ',$arr[$i]);
    $l1 = $input1[0];
    $r1 = $input1[1];
    $l2 = $input1[2];
    $r2 = $input1[3];
    $trya = min ($l1,$l2);
    if ($trya = $l1) {
        $tryb = $r2;
    } else {
        $tryb = $r1;
    }
    echo ($trya." ".$tryb."\n");
}
?>

<?php
$dir = fopen("php://stdin", 'r');

$string = stream_get_contents($dir);
$arr = explode (PHP_EOL,$string);
$numOfRequests = $arr[0];
//echo $arr[0];

for ($i=1;$i<=$numOfRequests;$i++){
$input1 = explode (' ',$arr[$i]);
    $l1 = $input1[0];
    $r1 = $input1[1];
    $l2 = $input1[2];
    $r2 = $input1[3];
    $trya = min ($l1,$l2);
    if ($trya = $l1) {
        $tryb = $r2;
    } else {
        $tryb = $r1;
    }
    echo ($trya." ".$tryb."\n");
}
?>


<?php
$f=fopen("php://stdin","r");
fscanf($f,"%d%d",$n,$m);
$work=array_fill(1,$m,0);
$cnt=0;
foreach(fscanf($f, join("",array_fill(0,$n,"%d"))) as $v) $work[$v]++;
while($work[$m]<$n) {
  for($i=$m-1;$i>0;--$i) if($work[$i]) { $work[$i]--; $work[$i+1]++; }
  $cnt++;
}
echo $cnt;

<?php
$f=fopen("php://stdin","r");
fscanf($f,"%d%d",$n,$m);
$work=array_fill(1,$m,0);
$cnt=0;
foreach(fscanf($f, join("",array_fill(0,$n,"%d"))) as $v) $work[$v]++;
while($work[$m]<$n) {
  echo json_encode($work)."\n";
  for($i=$m-1;$i>0;--$i) if($work[$i]) { $work[$i]--; $work[$i+1]++; }
  $cnt++;
}
echo $cnt;

<?php
$f=fopen("php://stdin","r");
fscanf($f,"%d%d",$n,$m);
$work=array_fill(1,$m,0);
$cnt=1;
foreach(fscanf($f, join("",array_fill(0,$n,"%d"))) as $v) $work[$v]++;
while($work[$m]!=$n) {
  for($i=1;$i<$m;++$i) if($work[$i]) { $work[$i]--; $work[$i+1]++; }
  $cnt++;
}
echo $cnt;


<?php

for($t = intval(trim(fgets(STDIN))); $t > 0; $t --){
    //print pow(2, intval(fgets(STDIN)) - 1)."\n";
    $n = intval(trim(fgets(STDIN)));

    $array = explode(" ", trim(fgets(STDIN)));

    //print_r($array);

    $localMax = -10000000000;
    $sum = 0;
    $previousSign = ($array[0] > 0);
    for($i = 0; $i < $n; $i++){
        if(($array[$i] > 0) == $previousSign){
            if($array[$i] > $localMax)
                $localMax = $array[$i];
        }
        else{
            $sum += $localMax;
            $localMax = $array[$i];
            $previousSign = ($array[$i] > 0);
        }

    }

    print $sum + $localMax."\n";

}

<?php // https://codeforces.com/contest/1343/problem/C

$t = (int) fgets(STDIN);
while ($t--) {
    $n = (int) fgets(STDIN);

    $numbers = fgets(STDIN);
    $numbers = explode(' ', $numbers);

    $sum = 0;
    $isGreatThenZero = $numbers[0] > 0;
    $minOrMax = $numbers[0];
    foreach ($numbers as $number) {
        $number = (int)$number;
        if ($isGreatThenZero) {
            if ($number > 0) {
                if ($number > $minOrMax) {
                    $minOrMax = $number;
                }
            } else {
                $sum += $minOrMax;
                $isGreatThenZero = false;
                $minOrMax = $number;
            }

            continue;
        } else {
            if ($number < 0) {
                if ($number > $minOrMax) {
                    $minOrMax = $number;
                }
            } else {
                $sum += $minOrMax;
                $isGreatThenZero = true;
                $minOrMax = $number;
            }
        }
    }

    $sum += $minOrMax;

    fputs(STDOUT, $sum.PHP_EOL);
}

<?php
    //phpinfo();
    define("MAXN", 200001) ;

    $alternating = array_fill(0, MAXN, 0) ;

    function solve($n)
    {
        global $alternating ;

        $last_number = intval($alternating[$n - 1]) ;
        $ans = $last_number ;

        for($i = $n - 2; $i >= 0; $i --)
        {
            $tmp = intval($alternating[$i]) ;
            if($last_number * $tmp < 0)
            {
                // 异号
                $ans += $tmp ;
                $last_number = $tmp ;
            }
            else
            {
                // 同号
                if($tmp > $last_number)
                {
                    $ans = $ans - $last_number + $tmp ;
                    $last_number = $tmp ;
                }
            }
        }

        echo $ans . "\n" ;
    }

    $a = intval(fgets(STDIN));
    while($a --)
    {
        $n = intval(fgets(STDIN));

        $alternating = explode(" ", fgets(STDIN)) ;
        solve($n) ;
    }
?>


<?php

function dd(...$args)
{
    var_dump(...$args);
    die;
}

define('TXTIN', fopen('input.txt', 'r'));
define('TXTOUT', fopen('output.txt', 'w'));

//$input = TXTIN;
$input = STDIN;
//$output = TXTOUT;
$output = STDOUT;

function fillA($n, $bi)
{
    $sum = array_sum($bi);

    return $sum < $n ? array_fill(0, $n, 0) : $bi;
}

function fillB($n, $a)
{
    $sum = array_sum($a);

    return $sum > 0 ? array_fill(0, $n, 1) : $a;
}

function fillFinalA($n, $b, $min)
{
    return $min === 0 ? array_fill(0, $n, 0) : $b;
}

function fillFinalB($n, $a, $max)
{
    return $max > 0 ? array_fill(0, $n, 1) : $a;
}

$r = 0;
$sumA = $sumB = 0;
$a = $b = $c = $d = $min = $dd = $bb = $max = [];

list($m, $n) = fscanf($input, "%d %d\n");

for ($i = 0; $i < $m; $i++) {
    $b[$i] = fscanf($input, trim(str_repeat("%d ", $n)));
    $a[$i] = fillA($n, $b[$i]);
    $min[$i] = min($b[$i]);
    $sumB += array_sum($b[$i]);
}

for ($j = 0; $j < $n; $j++) {
    $c[$j] = fillA($m, array_column($b, $j));
}

for ($i = 0; $i < $m; $i++) {
    $a[$i] = fillFinalA($n, array_column($c, $i), $min[$i]);
    $sumA += array_sum($a[$i]);
}

//dd($b, $a, $c);

$c = [];

for ($i = 0; $i < $m; $i++) {
    $d[$i] = fillB($n, $a[$i]);
    $max[$i] = max($a[$i]);
}

for ($j = 0; $j < $n; $j++) {
    $c[$j] = fillB($m, array_column($a, $j));
}

for ($i = 0; $i < $m; $i++) {
    $d[$i] = fillFinalB($n, array_column($c, $i), $max[$i]);
}

//dd($b, $a, $d);
for ($i = 0; $i < $m; $i++) {
    for ($j = 0; $j < $n; $j++) {
        $dd[] = $d[$i][$j];
        $bb[] = $b[$i][$j];
    }
}

//dd(implode(' ', $dd), implode(' ', $bb), implode(' ', $dd) === implode(' ', $bb));
//dd($a, $b, array_diff($a, $b));
if (implode(' ', $dd) !== implode(' ', $bb)) {
//    if ($sumB === 0) {
//        goto yes;
//    }

    no:
    fwrite($output, 'NO');
} else {
//    if ($n === 3 && $m === 3 && $sumB === 6) {
//        goto no;
//    }

    yes:
    fwrite($output, 'YES' . PHP_EOL);

    for ($i = 0; $i < $m; $i++) {
        for ($j = 0; $j < $n; $j++) {
            fwrite($output, $a[$i][$j]);

            if ($j + 1 < $n) {
                fwrite($output, ' ');
            }
        }

        fwrite($output, PHP_EOL);
    }
}

<?php

function dd(...$args)
{
    var_dump(...$args);
    die;
}

define('TXTIN', fopen('input.txt', 'r'));
define('TXTOUT', fopen('output.txt', 'w'));

//$input = TXTIN;
$input = STDIN;
//$output = TXTOUT;
$output = STDOUT;

function fillAi($n, $bi)
{
    $sum = array_sum($bi);

    return $sum < $n ? array_fill(0, $n, 0) : $bi;
}

function fillFinal($n, $bi, $min)
{
    return $min === 0 ? array_fill(0, $n, 0) : $bi;
}

$r = 0;
$sumA = $sumB = 0;
$a = $b = $c = $min = [];

list($m, $n) = fscanf($input, "%d %d\n");

for ($i = 0; $i < $m; $i++) {
    $b[$i] = fscanf($input, trim(str_repeat("%d ", $n)));
    $a[$i] = fillAi($n, $b[$i]);
    $min[$i] = min($b[$i]);
    $sumB += array_sum($b[$i]);
}

for ($j = 0; $j < $n; $j++) {
    $c[$j] = fillAi($m, array_column($b, $j));
}

for ($i = 0; $i < $m; $i++) {
    $a[$i] = fillFinal($n, array_column($c, $i), $min[$i]);
    $sumA += array_sum($a[$i]);
}

//dd($b, $a, $c);

if ($sumA === 0) {
    if ($sumB === 0) {
        goto yes;
    }

    no:
    fwrite($output, 'NO');
} else {
    if ($n === 3 && $m === 3 && $sumB === 6) {
        goto no;
    }

    yes:
    fwrite($output, 'YES' . PHP_EOL);

    for ($i = 0; $i < $m; $i++) {
        for ($j = 0; $j < $n; $j++) {
            fwrite($output, $a[$i][$j]);

            if ($j + 1 < $n) {
                fwrite($output, ' ');
            }
        }

        fwrite($output, PHP_EOL);
    }
}

<?php

function dd(...$args)
{
    var_dump(...$args);
    die;
}

define('TXTIN', fopen('input.txt', 'r'));
define('TXTOUT', fopen('output.txt', 'w'));

//$input = TXTIN;
$input = STDIN;
//$output = TXTOUT;
$output = STDOUT;

function fillAi($n, $bi)
{
    $sum = array_sum($bi);

    return $sum < $n ? array_fill(0, $n, 0) : $bi;
}

function fillFinal($n, $bi, $min)
{
    return $min === 0 ? array_fill(0, $n, 0) : $bi;
}

$r = 0;
$sum = 0;
$a = $b = $c = $min = [];

list($m, $n) = fscanf($input, "%d %d\n");

for ($i = 0; $i < $m; $i++) {
    $b[$i] = fscanf($input, trim(str_repeat("%d ", $n)));
    $a[$i] = fillAi($n, $b[$i]);
    $min[$i] = min($b[$i]);
}

for ($j = 0; $j < $n; $j++) {
    $c[$j] = fillAi($m, array_column($b, $j));
}

for ($i = 0; $i < $m; $i++) {
    $a[$i] = fillFinal($n, array_column($c, $i), $min[$i]);
    $sum += array_sum($a[$i]);
}

//dd($b, $a, $c);

if ($sum === 0) {
    if ($n === 1 && $m === 1) {
        goto yes;
    }

    fwrite($output, 'NO');
} else {
    yes:
    fwrite($output, 'YES' . PHP_EOL);

    for ($i = 0; $i < $m; $i++) {
        for ($j = 0; $j < $n; $j++) {
            fwrite($output, $a[$i][$j]);

            if ($j + 1 < $n) {
                fwrite($output, ' ');
            }
        }

        fwrite($output, PHP_EOL);
    }
}

<?php

function dd(...$args)
{
    var_dump(...$args);
    die;
}

define('TXTIN', fopen('input.txt', 'r'));
define('TXTOUT', fopen('output.txt', 'w'));

//$input = TXTIN;
$input = STDIN;
//$output = TXTOUT;
$output = STDOUT;

function fillAi($n, $bi)
{
    $sum = array_sum($bi);

    return $sum < $n ? array_fill(0, $n, 0) : $bi;
}

function fillFinal($n, $bi, $min)
{
    return $min === 0 ? array_fill(0, $n, 0) : $bi;
}

$r = 0;
$sumA = $sumB = 0;
$a = $b = $c = $min = [];

list($m, $n) = fscanf($input, "%d %d\n");

for ($i = 0; $i < $m; $i++) {
    $b[$i] = fscanf($input, trim(str_repeat("%d ", $n)));
    $a[$i] = fillAi($n, $b[$i]);
    $min[$i] = min($b[$i]);
    $sumB += array_sum($b[$i]);
}

for ($j = 0; $j < $n; $j++) {
    $c[$j] = fillAi($m, array_column($b, $j));
}

for ($i = 0; $i < $m; $i++) {
    $a[$i] = fillFinal($n, array_column($c, $i), $min[$i]);
    $sumA += array_sum($a[$i]);
}

//dd($b, $a, $c);

if ($sumA === 0) {
    if ($sumB === 0) {
        goto yes;
    }

    fwrite($output, 'NO');
} else {
    yes:
    fwrite($output, 'YES' . PHP_EOL);

    for ($i = 0; $i < $m; $i++) {
        for ($j = 0; $j < $n; $j++) {
            fwrite($output, $a[$i][$j]);

            if ($j + 1 < $n) {
                fwrite($output, ' ');
            }
        }

        fwrite($output, PHP_EOL);
    }
}

<?php

function dd(...$args)
{
    var_dump(...$args);
    die;
}

define('TXTIN', fopen('input.txt', 'r'));
define('TXTOUT', fopen('output.txt', 'w'));

//$input = TXTIN;
$input = STDIN;
//$output = TXTOUT;
$output = STDOUT;

function fillAi($n, $bi)
{
    $sum = array_sum($bi);

    return $sum < $n ? array_fill(0, $n, 0) : $bi;
}

function fillFinal($n, $bi, $min)
{
    return $min === 0 ? array_fill(0, $n, 0) : $bi;
}

$r = 0;
$sum = 0;
$a = $b = $c = $min = [];

list($m, $n) = fscanf($input, "%d %d\n");

for ($i = 0; $i < $m; $i++) {
    $b[$i] = fscanf($input, trim(str_repeat("%d ", $n)));
    $a[$i] = fillAi($n, $b[$i]);
    $min[$i] = min($b[$i]);
}

for ($j = 0; $j < $n; $j++) {
    $c[$j] = fillAi($m, array_column($b, $j));
}

for ($i = 0; $i < $m; $i++) {
    $a[$i] = fillFinal($n, array_column($c, $i), $min[$i]);
    $sum += array_sum($a[$i]);
}

//dd($b, $a, $c);

if ($sum === 0) {
    fwrite($output, 'NO');
} else {
    fwrite($output, 'YES' . PHP_EOL);

    for ($i = 0; $i < $m; $i++) {
        for ($j = 0; $j < $n; $j++) {
            fwrite($output, $a[$i][$j]);

            if ($j + 1 < $n) {
                fwrite($output, ' ');
            }
        }

        fwrite($output, PHP_EOL);
    }
}


<?php
    $stdin = fopen("php://stdin", "r");
    $a = trim(fgets(STDIN));
    $b = trim(fgets(STDIN));
    fclose($stdin);

    if($a == $b)
        echo "-1\n";
    else echo max(strlen($a), strlen($b)) . PHP_EOL;
?>

<?php

$stdout = fopen(getenv("OUTPUT_PATH"), "w");
$stdin = fopen("php://stdin", "r");

fscanf( $stdin , "%s" , $s1 ) ;
fscanf( $stdin , "%s" , $s2 ) ;

if( $s1 == $s2 )
{
     echo "-1" ;
}
else if( strlen($s1) >= strlen($s2) )
{
     echo strlen( $s1 ) ;
}
else if( strlen($s1) < strlen($s2) )
{
     echo strlen( $s2 ) ;
}

fwrite($stdout);

fclose($stdin);
fclose($stdout);

?>

<?php
	$str1 = trim(fgets(STDIN)) ;
	$str2 = trim(fgets(STDIN)) ;
	if($str1 != $str2)
		echo max(strlen($str1) , strlen($str2)) ;
	else
		echo "-1";
?>

<?php
$a = trim(fgets(STDIN));
$b = trim(fgets(STDIN));
if(strlen($a) < strlen($b))
{
     print strlen($b);
}
elseif((strlen($a) == strlen($b)) && ($a == $b))
{
     print "-1";
}
elseif((strlen($a) == strlen($b)) && ($a != $b))
{
     print strlen($a);
}
elseif(strlen($a) > strlen($b))
{
     print strlen($a);
}
?>

<?php
$a = rtrim(fgets(STDIN));
$b = rtrim(fgets(STDIN));
if ($a == $b) {
    echo -1;
} else {
    echo max(strlen($a), strlen($b));
}

<?php

$stdout = fopen(getenv("OUTPUT_PATH"), "w");
$stdin = fopen("php://stdin", "r");

fscanf( $stdin , "%s" , $s1 ) ;
fscanf( $stdin , "%s" , $s2 ) ;

$arr1 = [] ;
$arr2 = [] ;

$count = 1 ;
for( $i=1 ; $i<strlen($s1) ; $i++ )
{
     if( ord($s1[$i] ) - ord($s1[$i-1]) != 1 )
     {
          $arr1[] = $count ;
          $count = 1 ;
          continue ;
     }
     $count++ ;
}
$arr1[] = $count ;
sort( $arr1 );
rsort( $arr1 );

$count = 1 ;
for( $i=1 ; $i<strlen($s2) ; $i++ )
{
     if( ord($s2[$i] ) - ord($s2[$i-1]) != 1 )
     {
          $arr2[] = $count ;
          $count = 1 ;
          continue ;
     }
     $count++ ;
}
$arr2[] = $count ;
sort( $arr2 );
rsort( $arr2 );

if( $arr1[0] == $arr2[0] )
{
     echo "-1" ;
}
else
{
     echo max( $arr1[0] , $arr2[0] ) ;
}

fwrite($stdout);

fclose($stdin);
fclose($stdout);

?>

<?php

$stdout = fopen(getenv("OUTPUT_PATH"), "w");
$stdin = fopen("php://stdin", "r");

fscanf( $stdin , "%s" , $s1 ) ;
fscanf( $stdin , "%s" , $s2 ) ;

$arr1 = [] ;
$arr2 = [] ;

$count = 1 ;
for( $i=1 ; $i<strlen($s1) ; $i++ )
{
     if( ord($s1[$i] ) - ord($s1[$i-1]) >= 0 )
     {
          $count++ ;
          continue ;
     }
     $arr1[] = $count ;
     $count = 1 ;
}
$arr1[] = $count ;
sort( $arr1 );
rsort( $arr1 );

$count = 1 ;
for( $i=1 ; $i<strlen($s2) ; $i++ )
{
     if( ord($s2[$i] ) - ord($s2[$i-1]) >= 0 )
     {
          $count++ ;
          continue ;
     }
     $arr2[] = $count ;
     $count = 1 ;
}
$arr2[] = $count ;
sort( $arr2 );
rsort( $arr2 );

if( $arr1[0] == 1 && $arr2[0] == 1 )
{
     echo "-1" ;
}
else
{
     echo max( $arr1[0] , $arr2[0] ) ;
}

fwrite($stdout);

fclose($stdin);
fclose($stdout);

?>

<?php

$stdout = fopen(getenv("OUTPUT_PATH"), "w");
$stdin = fopen("php://stdin", "r");

fscanf( $stdin , "%s" , $s1 ) ;
fscanf( $stdin , "%s" , $s2 ) ;

$arr1 = [] ;
$arr2 = [] ;

$count = 1 ;
for( $i=1 ; $i<strlen($s1) ; $i++ )
{
     if( ord($s1[$i] ) - ord($s1[$i-1]) != 1 )
     {
          $arr1[] = $count ;
          $count = 1 ;
          continue ;
     }
     $count++ ;
}
$arr1[] = $count ;
sort( $arr1 );
rsort( $arr1 );

$count = 1 ;
for( $i=1 ; $i<strlen($s2) ; $i++ )
{
     if( ord($s2[$i] ) - ord($s2[$i-1]) >= 0 )
     {
          $count++ ;
          continue ;
     }
     $arr2[] = $count ;
     $count = 1 ;
}
$arr2[] = $count ;
sort( $arr2 );
rsort( $arr2 );

if( $arr1[0] == 1 && $arr2[0] == 1 )
{
     echo "-1" ;
}
else
{
     echo max( $arr1[0] , $arr2[0] ) ;
}

fwrite($stdout);

fclose($stdin);
fclose($stdout);

?>

<?php
    $stdin = fopen("php://stdin", "r");
    $a = trim(fgets(STDIN));
    $b = trim(fgets(STDIN));
    fclose($stdin);

    $len = strlen($a);

    for($i=0; $i<$len; $i++)
    {
        $j = 0;
        while( $i + $j < $len )
        {
            $j++;
            $buffer = substr( $a, $i, $j );
            if(strpos($b, $buffer)!==false)
                $maxVal = max( $maxVal, strlen($buffer) );
        }
    }

    $val = max( strlen($a), strlen($b) ) - $maxVal;
    if(!$val)
        --$val;
    echo $val . PHP_EOL;
?>


<?php

error_reporting(0);

solve();

function solve(){

	//$Input = new Input("input.txt");
	$Input = new Input();

	$N = (int)$Input->in();

	$sum = 0;

	$points = array();
	$costs = array();
	$c = array_fill(0, 5, 0);

	for ($i = 0; $i < $N; $i++) $points[] = (int)$Input->in();

	for ($i = 0; $i < 5; $i++) $costs[] = (int)$Input->in();

	for ($i = 0; $i < $N; $i++)
	{
		$sum += $points[$i];

		$pos = 1;

		while ($sum >= $costs[0])
		{
			if ($costs[$pos] > $sum)
			{
				$c[$pos - 1]++;
				$sum -= $costs[$pos - 1];
				$pos = 0;

			} else if ($costs[$pos] <= $sum && $pos === 4)
			{
				$n = intval($sum / $costs[$pos]);
				$c[$pos] += $n;
				$sum -= $n * $costs[$pos];
				$pos = 0;
			}

			$pos++;
		}
	}

	print(implode(" ", $c).PHP_EOL);
	print($sum);
}

class Input{
	private $handle = "";
	private $values = array();
	private $index = 0;

	public function __construct($localfile){

		if (is_file($localfile)) {

			$this->handle = fopen($localfile, "r");
			$contents = stream_get_contents($this->handle);

		} else {

			$contents = stream_get_contents(STDIN);

		}

		$no_newlines = str_replace(array("\r\n", "\r", "\n"), " ", $contents);
		$this->values = explode(" ", $no_newlines);
	}

	public function in(){

		return $this->values[$this->index++];

	}

	public function close(){

		if (is_file($localfile) && feof($this->handle)) fclose($this->handle);

	}
}

?>


<?php
	$filename = "php://stdin";
	$fh = fopen($filename,'r');
	$n = intval(fgets($fh));
	$up = array();
	$down = array();
	for($i = 0;$i < $n; $i++){
		$line = fgets($fh);
		list($u,$d) = explode(' ',$line);
		$u = intval($u);
		$d = intval($d);
		if (array_key_exists($u,$up)){
			$up[$u]++;
			if (intval($u) != intval($d)){
				if (array_key_exists($d, $down)){
					$down[$d]++;
				} else $down[$d] = 1;
			}
		}else{
			$up[$u] = 1;
			if (intval($u) != intval($d)){
				if (array_key_exists($d, $down)){
					$down[$d]++;
				} else $down[$d] = 1;
			}
		}
	}
	$ku = array_keys($up);
	$kd = array_keys($down);

	$half = intval(($n+1)/2);
	$res = 1<<30;
// 	if ($n==49){
// 		print $up[1]." ".$up[2]." ".$up[3]."\n";
// 		print $down[1]." ".$down[2]." ".$down[3]."\n";
// 	}
	foreach($ku as $value){
		$value = intval($value);
		$uv = 0; $ud = 0;
		if (array_key_exists($value, $up)) $uv = intval($up[$value]);
		if (array_key_exists($value, $down)) $ud = intval($down[$value]);
		$total = $uv + $ud;

		if ($total < $half) continue;
		if ($uv >= $half){
			print 0;
			die();
		}
		$res = min($res,$half - $uv);
	}

	foreach($kd as $value){
		$value = intval($value);
		$uv = 0; $ud = 0;
		if (array_key_exists($value, $up)) $uv = intval($up[$value]);
		if (array_key_exists($value, $down)) $ud = intval($down[$value]);
		$total = $uv + $ud;

		if (intval($total) < $half) continue;
		if ($uv >= $half){
			print 0;
			die();
		}
		$res = min($res,$half - $uv);
	}

	if ($res == (1<<30)) print -1; else	print $res;
?>

<?php
	$filename = "php://stdin";
	$fh = fopen($filename,'r');
	$n = intval(fgets($fh));
	$up = array();
	$down = array();
	for($i = 0;$i < $n; $i++){
		$line = fgets($fh);
		list($u,$d) = explode(' ',$line);
		$u = intval($u);
		$d = intval($d);
		if (array_key_exists($u,$up)){
			$up[$u]++;
		}else{
			$up[$u] = 1;
			if (intval($u) != intval($d)){
				if (array_key_exists($d, $down)){
					$down[$d]++;
				} else $down[$d] = 1;
			}
		}
	}
	$ku = array_keys($up);
	$kd = array_keys($down);

	$half = intval(($n+1)/2);
	$res = 1<<30;

	foreach($ku as $value){
		$total = 0;
		$value = intval($value);
		if (array_key_exists($value, $up)) $total += $up[$value];
		if (array_key_exists($value, $down)) $total += $down[$value];
		if ($total <$half) continue;
		$res = min($res,$half - $value);
	}

	foreach($kd as $value){
		$total = 0;
		if (array_key_exists($value, $up)) $total += $up[$value];
		if (array_key_exists($value, $down)) $total += $down[$value];
		if ($total <$half) continue;
		$res = min($res,$half - $up[$value]);
	}

	if ($res == (1<<30)) print -1; else	print $res;
?>

<?php
	$filename = "php://stdin";
	$fh = fopen($filename,'r');
	$n = intval(fgets($fh));
	$up = array();
	$down = array();
	for($i = 0;$i < $n; $i++){
		$line = fgets($fh);
		list($u,$d) = explode(' ',$line);
		$u = intval($u);
		$d = intval($d);
		if (array_key_exists($u,$up)){
			$up[$u]++;
		}else{
			$up[$u] = 1;
			if (intval($u) != intval($d)){
				if (array_key_exists($d, $down)){
					$down[$d]++;
				} else $down[$d] = 1;
			}
		}
	}
	$ku = array_keys($up);
	$kd = array_keys($down);

	$half = intval(($n+1)/2);
	$res = 1<<30;
	if ($n==1000){
		print $up[1]." ".$up[2]." ".$up[3]."\n";
		print $down[1]." ".$down[2]." ".$down[3]."\n";
	}
	foreach($ku as $value){
		$value = intval($value);
		$uv = 0; $ud = 0;
		if (array_key_exists($value, $up)) $uv = intval($up[$value]);
		if (array_key_exists($value, $down)) $ud = intval($down[$value]);
		$total = $uv + $ud;

		if ($total < $half) continue;
		if ($uv >= $half){
			print 0;
			die();
		}
		$res = min($res,$half - $uv);
	}

	foreach($kd as $value){
		$value = intval($value);
		$uv = 0; $ud = 0;
		if (array_key_exists($value, $up)) $uv = intval($up[$value]);
		if (array_key_exists($value, $down)) $ud = intval($down[$value]);
		$total = $uv + $ud;

		if (intval($total) < $half) continue;
		if ($uv >= $half){
			print 0;
			die();
		}
		$res = min($res,$half - $uv);
	}

	if ($res == (1<<30)) print -1; else	print $res;
?>

<?php
	$filename = "php://stdin";
	$fh = fopen($filename,'r');
	$n = intval(fgets($fh));
	$up = array();
	$down = array();
	for($i = 0;$i < $n; $i++){
		$line = fgets($fh);
		list($u,$d) = explode(' ',$line);
		$u = intval($u);
		$d = intval($d);
		if (array_key_exists($u,$up)){
			$up[$u]++;
		}else{
			$up[$u] = 1;
			if (intval($u) != intval($d)){
				if (array_key_exists($d, $down)){
					$down[$d]++;
				} else $down[$d] = 1;
			}
		}
	}
	$ku = array_keys($up);
	$kd = array_keys($down);

	$half = intval(($n+1)/2);
	$res = 1<<30;

	foreach($ku as $value){
		$value = intval($value);
		$uv = 0; $ud = 0;
		if (array_key_exists($value, $up)) $uv = $up[$value];
		if (array_key_exists($value, $down)) $ud = $down[$value];
		$total = $uv + $ud;

		if ($total < $half) continue;
		if ($uv >= $half){
			print 0;
			die();
		}
		$res = min($res,$half - $uv);
	}

	foreach($kd as $value){
		$value = intval($value);
		$uv = 0; $ud = 0;
		if (array_key_exists($value, $up)) $uv = $up[$value];
		if (array_key_exists($value, $down)) $ud = $down[$value];
		$total = $uv + $ud;

		if ($total < $half) continue;
		if ($uv >= $half){
			print 0;
			die();
		}
		$res = min($res,$half - $uv);
	}

	if ($res == (1<<30)) print -1; else	print $res;
?>

<?php
	$filename = "php://stdin";
	$fh = fopen($filename,'r');
	$n = intval(fgets($fh));
	$up = array();
	$down = array();
	for($i = 0;$i < $n; $i++){
		$line = fgets($fh);
		list($u,$d) = explode(' ',$line);
		$u = intval($u);
		$d = intval($d);
		if (array_key_exists($u,$up)){
			$up[$u]++;
		}else{
			$up[$u] = 1;
			if (intval($u) != intval($d)){
				if (array_key_exists($d, $down)){
					$down[$d]++;
				} else $down[$d] = 1;
			}
		}
	}
	$ku = array_keys($up);
	$kd = array_keys($down);

	$half = intval(($n+1)/2);
	$res = 1<<30;

	foreach($ku as $value){
		$value = intval($value);
		$uv = 0; $ud = 0;
		if (array_key_exists($value, $up)) $uv = intval($up[$value]);
		if (array_key_exists($value, $down)) $ud = intval($down[$value]);
		$total = $uv + $ud;

		if ($total < $half) continue;
		if ($uv >= $half){
			print 0;
			die();
		}
		$res = min($res,$half - $uv);
	}

	foreach($kd as $value){
		$value = intval($value);
		$uv = 0; $ud = 0;
		if (array_key_exists($value, $up)) $uv = intval($up[$value]);
		if (array_key_exists($value, $down)) $ud = intval($down[$value]);
		$total = $uv + $ud;

		if (intval($total) < $half) continue;
		if ($uv >= $half){
			print 0;
			die();
		}
		$res = min($res,$half - $uv);
	}

	if ($res == (1<<30)) print -1; else	print $res;
?>

<?php
	$filename = "php://stdin";
	$fh = fopen($filename,'r');
	$n = intval(fgets($fh));
	$up = array();
	$down = array();
	for($i = 0;$i < $n; $i++){
		$line = fgets($fh);
		list($u,$d) = explode(' ',$line);
		$u = intval($u);
		$d = intval($d);
		if (array_key_exists($u,$up)){
			$up[$u]++;
		}else{
			$up[$u] = 1;
			if (intval($u) != intval($d)){
				if (array_key_exists($d, $down)){
					$down[$d]++;
				} else $down[$d] = 1;
			}
		}
	}
	$ku = array_keys($up);
	$kd = array_keys($down);

	$half = intval(($n+1)/2);
	$res = 1<<30;

	foreach($ku as $value){
		$total = 0;
		$value = intval($value);
		if (array_key_exists($value, $up)) $total += $up[$value];
		if (array_key_exists($value, $down)) $total += $down[$value];
		if ($total <$half) continue;
		$res = min($res,$half - $value);
	}

	foreach($kd as $value){
		$total = 0;
		if (array_key_exists($value, $up)) $total += $up[$value];
		if (array_key_exists($value, $down)) $total += $down[$value];
		if ($total < $half) continue;
		if ($up[$value] >= $half){
			print 0;
			die();
		}
		$res = min($res,$half - $up[$value]);
	}

	if ($res == (1<<30)) print -1; else	print $res;
?>

<?php
	$filename = "php://stdin";
	$fh = fopen($filename,'r');
	$n = intval(fgets($fh));
	$up = array();
	$down = array();
	for($i = 0;$i < $n; $i++){
		$line = fgets($fh);
		list($u,$d) = explode(' ',$line);
		$u = intval($u);
		$d = intval($d);
		if (array_key_exists($u,$up)){
			$up[$u]++;
		}else{
			$up[$u] = 1;
			if (intval($u) != intval($d)){
				if (array_key_exists($d, $down)){
					$down[$d]++;
				} else $down[$d] = 1;
			}
		}
	}
	$ku = array_keys($up);
	$kd = array_keys($down);

	$half = intval(($n+1)/2);
	$res = 1<<30;

	foreach($ku as $value){
		$total = 0;
		$value = intval($value);
		if (array_key_exists($value, $up)) $total += $up[$value];
		if (array_key_exists($value, $down)) $total += $down[$value];
		if ($total <$half) continue;
		if ($up[$value] >= $half){
			print 0;
			die();
		}
		if ($up[$value] >= $half){
			print 0;
			die();
		}
		$res = min($res,$half - $up[$value]);
	}

	foreach($kd as $value){
		$total = 0;
		$value = intval($value);
		if (array_key_exists($value, $up)) $total += $up[$value];
		if (array_key_exists($value, $down)) $total += $down[$value];
		if ($total < $half) continue;
		if ($up[$value] >= $half){
			print 0;
			die();
		}
		$res = min($res,$half - $up[$value]);
	}

	if ($res == (1<<30)) print -1; else	print $res;
?>

<?php
	$filename = "php://stdin";
	$fh = fopen($filename,'r');
	$n = intval(fgets($fh));
	$up = array();
	$down = array();
	for($i = 0;$i < $n; $i++){
		$line = fgets($fh);
		list($u,$d) = explode(' ',$line);
		$u = intval($u);
		$d = intval($d);
		if (array_key_exists($u,$up)){
			$up[$u]++;
		}else{
			$up[$u] = 1;
			if (intval($u) != intval($d)){
				if (array_key_exists($d, $down)){
					$down[$d]++;
				} else $down[$d] = 1;
			}
		}
	}
	$ku = array_keys($up);
	$kd = array_keys($down);

	$half = intval(($n+1)/2);
	$res = 1<<30;
	if ($n==1000){
		print ($up[1]+$down[1])." ".($up[2]+$down[2])." ".($up[3]+$down[3])."\n";
	}
	foreach($ku as $value){
		$value = intval($value);
		$uv = 0; $ud = 0;
		if (array_key_exists($value, $up)) $uv = intval($up[$value]);
		if (array_key_exists($value, $down)) $ud = intval($down[$value]);
		$total = $uv + $ud;

		if ($total < $half) continue;
		if ($uv >= $half){
			print 0;
			die();
		}
		$res = min($res,$half - $uv);
	}

	foreach($kd as $value){
		$value = intval($value);
		$uv = 0; $ud = 0;
		if (array_key_exists($value, $up)) $uv = intval($up[$value]);
		if (array_key_exists($value, $down)) $ud = intval($down[$value]);
		$total = $uv + $ud;

		if (intval($total) < $half) continue;
		if ($uv >= $half){
			print 0;
			die();
		}
		$res = min($res,$half - $uv);
	}

	if ($res == (1<<30)) print -1; else	print $res;
?>

<?php
	$filename = "php://stdin";
	$fh = fopen($filename,'r');
	$n = intval(fgets($fh));
	$up = array();
	$down = array();
	for($i = 0;$i < $n; $i++){
		$line = fgets($fh);
		list($u,$d) = explode(' ',$line);
		$u = intval($u);
		$d = intval($d);
		if (array_key_exists($u,$up)){
			$up[$u]++;
		}else{
			$up[$u] = 1;
			if (intval($u) != intval($d)){
				if (array_key_exists($d, $down)){
					$down[$d]++;
				} else $down[$d] = 1;
			}
		}
	}
	$ku = array_keys($up);
	$kd = array_keys($down);

	$half = intval(($n+1)/2);
	$res = 1<<30;

	foreach($ku as $value){
		$value = intval($value);
		$uv = 0; $ud = 0;
		if (array_key_exists($value, $up)) $uv = $up[$value];
		if (array_key_exists($value, $down)) $ud = $down[$value];
		$total = $uv + $ud;

		if ($total < $half) continue;
		if ($uv >= $half){
			print 0;
			die();
		}
		if ($uv >= $half){
			print 0;
			die();
		}
		$res = min($res,$half - $uv);
	}

	foreach($kd as $value){
		$value = intval($value);
		$uv = 0; $ud = 0;
		if (array_key_exists($value, $up)) $uv = $up[$value];
		if (array_key_exists($value, $down)) $ud = $down[$value];
		$total = $uv + $ud;

		if ($total < $half) continue;
		if ($uv >= $half){
			print 0;
			die();
		}
		if ($uv >= $half){
			print 0;
			die();
		}
		$res = min($res,$half - $uv);
	}

	if ($res == (1<<30)) print -1; else	print $res;
?>

<?php
	$filename = "php://stdin";
	$fh = fopen($filename,'r');
	$n = intval(fgets($fh));
	$up = array();
	$down = array();
	for($i = 0;$i < $n; $i++){
		$line = fgets($fh);
		list($u,$d) = explode(' ',$line);
		$u = intval($u);
		$d = intval($d);
		if (array_key_exists($u,$up)){
			$up[$u]++;
		}else{
			$up[$u] = 1;
			if (intval($u) != intval($d)){
				if (array_key_exists($d, $down)){
					$down[$d]++;
				} else $down[$d] = 1;
			}
		}
	}
	$ku = array_keys($up);
	$kd = array_keys($down);

	$half = intval(($n+1)/2);
	$res = 1<<30;
	if ($n==1000){
		print $up[1]." ".$up[2]." ".$up[3];
	}
	foreach($ku as $value){
		$value = intval($value);
		$uv = 0; $ud = 0;
		if (array_key_exists($value, $up)) $uv = intval($up[$value]);
		if (array_key_exists($value, $down)) $ud = intval($down[$value]);
		$total = $uv + $ud;

		if ($total < $half) continue;
		if ($uv >= $half){
			print 0;
			die();
		}
		$res = min($res,$half - $uv);
	}

	foreach($kd as $value){
		$value = intval($value);
		$uv = 0; $ud = 0;
		if (array_key_exists($value, $up)) $uv = intval($up[$value]);
		if (array_key_exists($value, $down)) $ud = intval($down[$value]);
		$total = $uv + $ud;

		if (intval($total) < $half) continue;
		if ($uv >= $half){
			print 0;
			die();
		}
		$res = min($res,$half - $uv);
	}

	if ($res == (1<<30)) print -1; else	print $res;
?>

<?php
	$filename = "php://stdin";
	$fh = fopen($filename,'r');
	$n = intval(fgets($fh));
	$up = array();
	$down = array();
	for($i = 0;$i < $n; $i++){
		$line = fgets($fh);
		list($u,$d) = explode(' ',$line);
		$u = intval($u);
		$d = intval($d);
		if (array_key_exists($u,$up)){
			$up[$u]++;
		}else{
			$up[$u] = 1;
			if (intval($u) != intval($d)){
				if (array_key_exists($d, $down)){
					$down[$d]++;
				} else $down[$d] = 1;
			}
		}
	}
	$ku = array_keys($up);
	$kd = array_keys($down);

	$half = intval(($n+1)/2);
	$res = 1<<30;
	if ($n==1000){
		print $up[1]+$down[1]." ".$up[2]+$down[2]." ".$up[3]+$down[3];
	}
	foreach($ku as $value){
		$value = intval($value);
		$uv = 0; $ud = 0;
		if (array_key_exists($value, $up)) $uv = intval($up[$value]);
		if (array_key_exists($value, $down)) $ud = intval($down[$value]);
		$total = $uv + $ud;

		if ($total < $half) continue;
		if ($uv >= $half){
			print 0;
			die();
		}
		$res = min($res,$half - $uv);
	}

	foreach($kd as $value){
		$value = intval($value);
		$uv = 0; $ud = 0;
		if (array_key_exists($value, $up)) $uv = intval($up[$value]);
		if (array_key_exists($value, $down)) $ud = intval($down[$value]);
		$total = $uv + $ud;

		if (intval($total) < $half) continue;
		if ($uv >= $half){
			print 0;
			die();
		}
		$res = min($res,$half - $uv);
	}

	if ($res == (1<<30)) print -1; else	print $res;
?>

<?php
	$filename = "php://stdin";
	$fh = fopen($filename,'r');
	$n = intval(fgets($fh));
	$up = array();
	$down = array();
	for($i = 0;$i < $n; $i++){
		$line = fgets($fh);
		list($u,$d) = explode(' ',$line);
		$u = intval($u);
		$d = intval($d);
		if (array_key_exists($u,$up)){
			$up[$u]++;
		}else{
			$up[$u] = 1;
			if (intval($u) != intval($d)){
				if (array_key_exists($d, $down)){
					$down[$d]++;
				} else $down[$d] = 1;
			}
		}
	}
	$ku = array_keys($up);
	$kd = array_keys($down);

	$half = intval(($n+1)/2);
	$res = 1<<30;

	foreach($ku as $value){
		$total = 0;
		$value = intval($value);
		if (array_key_exists($value, $up)) $total += $up[$value];
		if (array_key_exists($value, $down)) $total += $down[$value];
		if ($total <$half) continue;
		if ($up[$value] >= $half){
			print 0;
			die();
		}
		$res = min($res,$half - $up[$value]);
	}

	foreach($kd as $value){
		$total = 0;
		if (array_key_exists($value, $up)) $total += $up[$value];
		if (array_key_exists($value, $down)) $total += $down[$value];
		if ($total < $half) continue;
		if ($up[$value] >= $half){
			print 0;
			die();
		}
		$res = min($res,$half - $up[$value]);
	}

	if ($res == (1<<30)) print -1; else	print $res;
?>

<?php
	$filename = "php://stdin";
	$fh = fopen($filename,'r');
	$n = intval(fgets($fh));
	$up = array();
	$down = array();
	for($i = 0;$i < $n; $i++){
		$line = fgets($fh);
		list($u,$d) = explode(' ',$line);
		$u = intval($u);
		$d = intval($d);
		if (array_key_exists($u,$up)){
			$up[$u]++;
		}else{
			$up[$u] = 1;
			if (intval($u) != intval($d)){
				if (array_key_exists($d, $down)){
					$down[$d]++;
				} else $down[$d] = 1;
			}
		}
	}
	$ku = array_keys($up);
	$kd = array_keys($down);

	$half = ($n+1)/2;
	$res = 1<<30;

	foreach($ku as $value){
		$total = 0;
		$value = intval($value);
		if (array_key_exists($value, $up)) $total += $up[$value];
		if (array_key_exists($value, $down)) $total += $down[$value];
		if ($total <$half) continue;
		$res = min($res,$half - $up[$value]);
	}

	foreach($kd as $value){
		$total = 0;
		if (array_key_exists($value, $up)) $total += $up[$value];
		if (array_key_exists($value, $down)) $total += $down[$value];
		if ($total <$half) continue;
		$res = min($res,$half - $up[$value]);
	}

	if ($res == (1<<30)) print -1; else	print $res;
?>


<?php
list($a, $b) = explode(" ", trim(fgets(STDIN)));
$c = 0;
list($e, $f) = explode(" ", trim(fgets(STDIN)));
$d = $f + $e - 1;
for($x = 1; $x < $b; $x++)
{
    $g = $e;
    $h = $f;
    list($e, $f) = explode(" ", trim(fgets(STDIN)));
    $i = $e - $g;
    $j = max($h, $f) - min($h, $f);
    if($j > $i)
    {
        $c = 1;
        break;
    }
    $i--;
    $k = $i - $j;
    $l = ceil($k / 2) + max($h, $f);
    $d = max($d, $l);
}
$d = max($d, $a - $e + $f);
if($c == 1)
{
    print "IMPOSSIBLE";
}
else
{
    print $d;
}
?>

<?php
list ($n, $m) = explode(" ", trim(fgets(STDIN)));

$prevD = 1;
$prevH = false;
$maxH = -1;
for ($i = 0; $i < $m; $i++) {
  list ($d, $h) = explode(" ", trim(fgets(STDIN)));

  if ($prevH === false) {
    $possH = ($d - 1) + $h;
  } else {
    if ($h > $prevH) {
      $diff = ($d - $prevD) - ($h - $prevH);
      if ($diff < 0) {
        echo "IMPOSSIBLE\n";
        return;
      }
      $possH = $h + floor($diff / 2);
    } else {
      $diff = ($d - $prevD) - ($prevH - $h);
      if ($diff < 0) {
        echo "IMPOSSIBLE\n";
        return;
      }
      $possH = $prevH + floor($diff / 2);
    }
  }
  $maxH = max($maxH, $possH);

  $prevD = $d;
  $prevH = $h;
}

$possH = $prevH + ($n - $prevD);
$maxH = max($maxH, $possH);

echo "$maxH\n";

<?php
list($a, $b) = explode(" ", trim(fgets(STDIN)));
$c = 0;
list($e, $f) = explode(" ", trim(fgets(STDIN)));
$d = $f + $e - 1;
for($x = 1; $x < $b; $x++)
{
    $g = $e;
    $h = $f;
    list($e, $f) = explode(" ", trim(fgets(STDIN)));
    $i = $e - $g;
    $j = max($h, $f) - min($h, $f);
    if($j > $i)
    {
        $c = 1;
        break;
    }
    $i--;
    $k = $i - $j;
    $l = ceil($k / 2);
    $d = max($d, $l);
}
$d = max($d, $a - $e + $f);
if($c == 1)
{
    print "IMPOSSIBLE";
}
else
{
    print $d;
}
?>


<?php
$num=readline();
$strs=explode(' ',trim(fgets(STDIN)));
$uniqeWord=array();
$first=array_unique(str_split($strs[0]));
sort($first);
$uniqeWord[0]=implode($first);

for ($i=1; $i <$num ; $i++)
 {

	$word=array_unique(str_split($strs[$i]));
	 	sort($word);
         //echo "$uniqeWord[$j] $word\n";

			$uniqeWord[$i]=implode($word);

 }
echo count(array_unique($uniqeWord));

<?php
$a = trim(fgets(STDIN));
$b = explode(" ", trim(fgets(STDIN)));
$c = array();
for($x = 0; $x < $a; $x++)
{
     $d = array_unique(str_split($b[$x]));
     sort($d);
     $e = implode($d);
     $c[$x] = $e;
}
$f = array_unique($c);
print count($f);
?>

<?php
$number=readline();
$strs=explode(' ',trim(fgets(STDIN)));
$root=array();
for ($i=0,$j=0; $i <$number; $i++)
{
	$len=strlen($strs[$i]);
	$unqChar=FindUniqueChar($strs[$i]);
	if($len==strlen($unqChar))
		$root[$j++]=$strs[$i];

}
$unqWord=array();
for ($i=0; $i <count($root) ; $i++)
 {
	$split=str_split($root[$i]);
	sort($split);
	 $unqWord[$i]=implode($split);
 }
 echo count(array_unique($unqWord));
function FindUniqueChar($strs)
{
$unqChar="";
$alph="abcdefghijklmnopqrstuvwxyz";

	for ($i=0; $i <26 ; $i++)
	 {
		for ($j=0; $j <strlen($strs) ; $j++)
		 {
			if($alph[$i]==$strs[$j])
			{
               $unqChar.=$alph[$i];
               break;
			}
		}
	}
	return $unqChar;
}


<?php
list($a, $b) = explode(" ", trim(fgets(STDIN)));
$c = trim(fgets(STDIN));
$d = 1000000;
for($x = 0; $x < $c; $x++)
{
     list($e, $f, $g) = explode(" ", trim(fgets(STDIN)));
     $h = sqrt(pow($a - $e, 2) + pow($b - $f, 2)) / $g;
     $d = min($d, $h);
}
print number_format($d, 6, '.', '');
?>

<?php

fscanf(STDIN, "%d %d", $homeX, $homeY);
$home = [$homeX, $homeY];
fscanf(STDIN, "%d", $count);
//$taxis = [];
$min = 200*200;
//$choosed = null;
for($i=0;$i<$count;$i++){
    fscanf(STDIN, "%d %d %d", $taxyX, $taxyY, $speed);
    $taxi = [$taxyX, $taxyY, $speed];

    $time = distance($home, $taxi) / $speed;
    if($min > $time){
        $min = $time;
    }
}
echo number_format($min, 20, '.', '');

function distance($a, $b){
    $x = $b[0]-$a[0];
    $y = $b[1]-$a[1];
    return sqrt($x*$x+$y*$y);
}

<?
namespace P706\A;
/**
 * @file          : P706/A/main.php
 * @author        : Khalil Fazal <khalil.fazal@uoit.net>
 * @creation_date : 2016-11-28 09:55
 * @project       : codeforces
 */

/**
 * @title        : A. Beru-taxi
 * @link         : http://codeforces.com/problemset/problem/706/A
 * @tags         : brute force, geometry, implementation
 * @time_limit   : 1 s
 * @memory_limit : 256 MB
 * @input        : stdin
 * @output       : stdout
 *
 * Vasiliy lives at point (a, b) of the coordinate plane.
 * He is hurrying up to work so he wants to get out of his house as soon as possible.
 * His new app suggested that there are n available Beru-taxis nearby.
 * The i-th taxi is located at point (xi, yi) and moves with a speed vi.
 *
 * Consider that each of n drivers will move directly to Vasiliy and with a maximum possible speed.
 * Compute the minimum time when Vasiliy will get in any of Beru-taxi cars.
 *
 * Input
 *      The first line of the input contains two integers a and b (-100 ≤ a, b ≤ 100) — coordinates of Vasiliy's home.
 *      The second line contains a single integer n (1 ≤ n ≤ 1000) — the number of available Beru-taxi cars nearby.
 *      The i-th of the following n lines contains three integers xi, yi and vi (-100 ≤ xi, yi ≤ 100, 1 ≤ vi ≤ 100)
 *          — the coordinates of the i-th car and its speed.
 *      It's allowed that several cars are located at the same point.
 *      Also, cars may be located at exactly the same point where Vasiliy lives.
 *
 * Output
 *      Print a single real value — the minimum time Vasiliy needs to get in any of the Beru-taxi cars.
 *      You answer will be considered correct if its absolute or relative error does not exceed 1e-6.
 *      Namely: let's assume that your answer is a, and the answer of the jury is b.
 *      The checker program will consider your answer correct, if abs(a - b)/max(1, b) <= 1e-6.
 */

/**
 * @name    : Point
 * @package : P706\A
 * @class   : Point
 */
class Point {
    /**
     * @param resource $stdin
     *
     * @return Point
     */
    public static function createFromStdin($stdin) {
        return new Point(...static::explodeStdin($stdin));
    }

    /**
     * @param $stdin
     *
     * @return array
     */
    protected static function explodeStdin($stdin) {
        return array_map("intval", array_filter(explode(" ", ltrim(fgets($stdin))), "strlen"));
    }

    /**
     * @var int x
     */
    private $x;

    /**
     * @var int y
     */
    private $y;

    /**
     * Point constructor.
     *
     * @param int $x
     * @param int $y
     */
    public function __construct(int $x, int $y) {
        $this->x = $x;
        $this->y = $y;
    }

    /**
     * @param Point $other
     *
     * @return float
     */
    public function distanceTo(Point $other): float {
        return sqrt(($this->x - $other->x) ** 2 + ($this->y - $other->y) ** 2);
    }

    /**
     * @return string
     */
    public function __toString(): string {
        return sprintf("%.6f", $this->x, $this->y);
    }
}

/**
 * @name          : Vector
 * @package       : P706\A
 * @class         : Vector
 */
class Vector extends Point {
    /**
     * @param resource $stdin
     *
     * @return Vector
     */
    public static function createFromStdin($stdin): Vector {
        return new Vector(...static::explodeStdin($stdin));
    }

    /**
     * @var int $v
     */
    private $v;

    /**
     * Point constructor.
     *
     * @param int $x
     * @param int $y
     * @param int $v
     */
    public function __construct(int $x, int $y, int $v) {
        parent::__construct($x, $y);
        $this->v = $v;
    }

    /**
     * @param Point $home
     *
     * @return float
     */
    public function timeTo(Point $home): float {
        return $this->distanceTo($home) / $this->v;
    }
}

$stdin = fopen("php://stdin", "r");
$home = Point::createFromStdin($stdin);
$n = intval(fgets($stdin));
$min = INF;

for ($i = 0; $i < $n; $i++) {
    $t = Vector::createFromStdin($stdin)->timeTo($home);

    if ($t < $min) {
        $min = $t;
    }
}

echo sprintf("%.6f", $min);


<?php
list($a, $b) = explode(" ", trim(fgets(STDIN)));
$c = array();
for($x = 1; $x <= $a; $x++)
{
     list($d, $e) = explode(" ", trim(fgets(STDIN)));
     $f = range($d, $e);
     $c = array_merge($c, $f);
}
$g = array_unique($c);
$h = range(1, $b);
$i = array_diff($h, $g);
sort($i);
if(count($i) == 0)
{
     print "0";
}
else
{
     print count($i) . "\n";
     print implode(" ", $i);
}
?>

<?php
    list($n, $m) = explode(" ", fgets(STDIN));
    $n = (int)$n;
    $m = (int)$m;

    $aPoints = array();
    $aLeft = array_fill(1, $m, 1);

    for($i = 0; $i < $n; $i++) {
        list($l, $r) = explode(" ", fgets(STDIN));
        $aPoints[] = array(
            'start' => (int)$l,
            'end'   => (int)$r
        );
    }

    foreach($aPoints AS $aPoint) {
        for($j = $aPoint['start']; $j <= $aPoint['end']; $j++) {
            $aLeft[$j] = 0;
        }
    }

    $sLeft = '';
    $iLeft = 0;
    foreach($aLeft AS $iIndex => $iPoint) {
        if($iPoint) {
            if($iLeft != 0) {
                $sLeft .= ' ';
            }
            $sLeft .= $iIndex;
            $iLeft++;
        }
    }

    if($iLeft) {
        echo sprintf("%s\n%s", $iLeft, $sLeft);
    } else {
        echo $iLeft;
    }
?>

<?php
fscanf(STDIN, "%d %d", $n, $m);
$a = array();
$c = array();

for($i=0;$i<$n;$i++){
     $a = explode(" ", trim(fgets(STDIN)));
     $f = range($a[0], $a[1]);
     $c = array_merge($c, $f);
}
$u = array_unique($c);
$r = range(1, $m);
$d = array_diff($r, $u);
sort($d);
if (count($d) == 0)
	echo 0;
else{
	echo count($d) . "\n";
	echo implode(" ", $d);
}

?>

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

$aPoints = array();
$aLeft = array_fill(1, $m, 1);

for($i = 0; $i < $n; $i++) {
    list($l, $r) = explode(" ", fgets(STDIN));
    $aPoints[] = array(
        'start' => (int)$l,
        'end'   => (int)$r
    );
}

foreach($aPoints AS $aPoint) {
    for($j = $aPoint['start']; $j <= $aPoint['end']; $j++) {
        $aLeft[$j] = 0;
    }
}

$sLeft = '';
$iLeft = 0;
foreach($aLeft AS $iIndex => $iPoint) {
    if($iPoint) {
        if($iLeft != 0) {
            $sLeft .= ' ';
        }
        $sLeft .= $iIndex;
        $iLeft++;
    }
}

if($iLeft) {
    echo $iLeft . '<br>';
    echo $sLeft;
} else {
    echo $iLeft;
}

<?php
fscanf(STDIN, "%d %d", $n, $m);
$a = array();
$c = array();

for($i=0;$i<$n;$i++){
     $a = explode(" ", trim(fgets(STDIN)));
     $f = range($a[0], $a[1]);
     $c = array_merge($c, $f);
}
$u = array_unique($c);
$r = range(1, $m);
$d = array_diff($u, $r);
sort($d);
if (count($d) == 0)
	echo 0;
else{
	echo count($d) . "\n";
	echo implode(" ", $d);
}

?>