USE plato;

$key = select min(key) from Input;
$value = select min(value) from Input;

INSERT INTO Output
SELECT * FROM (
    SELECT $key as key
    UNION ALL
    SELECT $value as val
)

