
#include <stdio.h>
#include <stdlib.h>
/*
 * 
 */
int main(int argc, char** argv) {

    
    int n;
    scanf("%d",&n);
    int A[n];
    int p, key, lc = 3, rc = 4;
    for(int i = 0; i < n; i++){
       
        scanf("%d",&A[i]);

    }
    
    for(int i = 0; i < n; i++){
        
        if(i == 0){
            printf("node %d: key = %d, left key = %d, right key = %d, \n", i+1 , A[i], A[i+1], A[i+2]);
            continue;
        }
        
        else
        {
            printf("node %d: key = %d, parent key = %d, ",i+1 , A[i], A[(i-1)/2] );
            if(lc < n)printf("left key = %d, ",A[lc]);
            if(rc < n)printf("right key = %d, ",A[rc]);
            lc = lc + 2;
            rc = rc + 2;
            printf("\n");
          
        }
    }
        
    return 0;
}

