#include <stdio.h>



int main(){
    int N, Array[250];
    scanf(%d\n,&N);
    for (int ix = 0 ; ix < N ; ix++){
        if ( ix == N-1) scanf("%d\n",&Array[ix]);
        else 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");
    }
}
