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

#define NIL -1

typedef struct{
  int k;
  int lk;
  int rk;
}Node;

int main(){

  Node *A;
  int h,i,x;

  scanf("%d",&h);

  A = malloc((h+1)*sizeof(Node));

  for(i = 1 ; i <= h ; i++) A[i].k = A[i].lk = A[i].rk = NIL;


  for(i = 1 ; i <= h ; i++){
    scanf("%d",&x);

    A[i].k = x;
    if(i%2 == 0) A[i/2].lk = x;
    else if(i%2 == 1) A[i/2].rk =x;

  }

  for(i = 1 ; i <= h ; i++){

    if(i == 1)
      printf("node %d: key = %d, left key = %d, right key = %d, "
             , i, A[i].k, A[i].lk, A[i].rk);

    else if(A[i].lk == NIL && A[i].rk ==NIL)
      printf("node %d: key = %d, parent key = %d, "
             , i, A[i].k, A[i/2].k);

    else if(A[i].lk == NIL)
      printf("node %d: key = %d, parent key = %d, right key = %d, "
             , i, A[i].k, A[i/2].k, A[i].rk);

    else if(A[i].rk == NIL)
      printf("node %d: key = %d, parent key = %d, left key = %d, "
             , i, A[i].k, A[i/2].k, A[i].lk);

    else
      printf("node %d: key = %d, parent key = %d, left key = %d, right key = %d, "
             , i, A[i].k, A[i/2].k, A[i].lk, A[i].rk);

    printf("\n");

  }

  return 0;

}