#include <stdio.h>

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