#include <stdio.h>

#define NIL -2000000001

int main(){
    int i,H,key[251];
    int p,l,r;

    scanf("%d",&H);

    for(i=1; i<=H; i++)scanf("%d",&key[i]);
    key[0] = NIL;
    for(i=1; i<=H; i++){
        p = i/2;
        l = i*2; 
        r = i*2+1;
        printf("node %d: key = %d, ",i,key[i]);
        if(key[p] != NIL) printf("parent key = %d, ",key[p]);
        if(l <= H) printf("left key = %d, ",key[l]);
        if(r <= H) printf("right key = %d, ",key[r]);

        printf("\n");
    }
    return 0;
}
