#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
int nodes[251];
 
int main(){
 
    int i, n;
 
    scanf("%d", &n);
 
    for(i=1; i<=n; i++){
        scanf("%d", &nodes[i]);
    }
     
    for(i=1; i<=n; i++){
        printf("node %d: ", i);
        printf("key = %d, ", nodes[i]);
        if(parentNode(i-i%2) > 0)
            printf("parent key = %d, ", nodes[parentNode(i-i%2)]);
        if(leftChild(i) <= n)
            printf("left key = %d, ", nodes[leftChild(i)]);
        if(rightChild(i) <= n)
            printf("right key = %d, ", nodes[rightChild(i)]);
        printf("\n");
    }
     
    return 0;
     
}