#include<stdio.h>

int main(){
    int i,n;
    scanf("%d",&n);
    int A[n];
    for(i=0;i<n;i++) scanf("%d",&A[i]);
    for(i=0;i<n;i++){
        printf("node %d: key = %d,",i,A[i]);
        if(i!=0) printf(" parent key = %d,",A[(i-1)/2]);
        if((i+1)*2>=0 && (i+1)*2<=n) printf(" left key = %d,",A[i*2+1]);
        if((i+1)*2+1>=0 && (i+1)*2+1<=n) printf(" right key = %d,",A[i*2+2]);
        printf("\n");
    }
    return 0;
}
