#include <stdio.h>

int Array[250];

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