#include <stdio.h>

static int heap[250+1];

int main(int argc, char* argv[]) {
    int H;
    int i;

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

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

    return 0;
}


