import std.stdio;
import std.conv;
import std.algorithm;
import std.range;
import std.string;
import std.typecons;
import std.math;
import std.random;
import std.range;
import std.functional;
import std.container;
void main()
{
    auto c = readln.strip.to!int;
    auto k = [0] ~ readln.strip.split(' ').map!(to!int).array;
    foreach (i; 1..c + 1)
    {
        write("node ", i, ": key = ", k[i], ", ");
        auto parent = i / 2;
        auto left = 2 * i;
        auto right = 2 * i + 1;
        if (parent >= 1)
            write("parent key = ", k[parent], ", ");
        if (left <= c)
            write("left key = ", k[left], ", ");
        if (right <= c)
            write("right key = ", k[right], ", ");
        writeln;
    }
}
