#include <stdio.h>


// I/O
int get_int() {
    int n = 0;
    int c = getchar_unlocked();
    if(c == 45) {
        c = getchar_unlocked();
        while(47 < c && c < 58) n = 10 * n + (c & 0xf), c = getchar_unlocked();
        return -n;
    } else if(c < 48 || 57 < c) return c;
    while(47 < c && c < 58) n = 10 * n + (c & 0xf), c = getchar_unlocked();
    return n;
}
void put_int(int n) {
    if(!n) {
        putchar_unlocked('0');
        return;
    }
    if(n < 0) n = -n, putchar_unlocked('-');
    char buf[11];
    int i = 0;
    while(n) buf[i++] = (char)(n % 10 + '0'), n /= 10;
    while(i--)putchar_unlocked(buf[i]);
}
void put_str(char *str) { while(*str) putchar_unlocked(*str++); }
//


int main(int argc, char **argv) {
    int h = get_int();
    int a[h + 1];
    for(int i = 1; i <= h; ++i) a[i] = get_int();
    for(int i = 1; i <= h; ++i) {
        put_str("node "), put_int(i);
        put_str(": key = "), put_int(a[i]), put_str(", ");
        if(i / 2) put_str("parent key = "), put_int(a[i / 2]), put_str(", ");
        if(i * 2 <= h) put_str("left key = "), put_int(a[i * 2]), put_str(", ");
        if(i * 2 + 1 <= h) put_str("right key = "), put_int(a[i * 2 + 1]), put_str(", ");
        putchar_unlocked('\n');
    }
    return 0;
}

