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

int main()
{
    int ppp[252];
    int n;
    scanf("%d", &n);

    for(int i=1; i<n+1; i++){
        scanf("%d",&ppp[i]);
    }

    for(int i=1; i<n+1; i++){
        printf("node %d: key = %d, ", i, ppp[i]);
        printf("parent key = %d, ", ppp[i/2]);
        if(i*2<=n) printf("left key = %d, ", ppp[i*2]);
        int aaa = i*2+1;
        if(aaa<=n) printf("right key = %d, ", ppp[i*2+1]);
        printf("\n");
    }

    return 0;
}

