#include <stdio.h>
#define N 251

int heap[N];

int right(int id) {
    return (2 * id) + 1;
}

int left(int id) {
    return 2 * id;
}

int parent(int id) {
    return id / 2;
}

void printNode(int id, int n) {
    printf("node %d: ", id);
    printf("key = %d, ", heap[id]);
    if (id > 1) {
        printf("parent key = %d, ", heap[parent(id)]);
    }
    if (left(id) <= n) {
        printf("left key = %d, ", heap[left(id)]);
    }
    if (right(id) <= n) {
        printf("right key = %d, ", heap[right(id)]);
    }
    printf("\n");
}

int main() {
    int i;
    int n;

    scanf("%d", &n);

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

    for (i = 1; i <= n; i++) {
        printNode(i, n);
    }

    return 0;
}
