#include<stdio.h>
#include<stdlib.h>
#include<string.h>

#define N 100000

int parent(int);
int left(int);
int right(int);
int n;

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


int parent(int id){
    static int pid = 0;
    
    if(id % 2 == 0){
        pid++;
    }
    if(pid == 0){
        return -1;
    }
    else{
        return pid;
    }
}

int left(int id){
    int lid;
    
    lid = 2 * id;
    
    if(lid <= n){
        return lid;
    }
    else{
        return -1;
    }
}

int right(int id){
    int rid;
    
    rid = 2 * id + 1;
    
    if(rid <= n){
        return rid;
    }
    else{
        return -1;
    }
}

