#include <stdio.h>

#define MAX 250
#define NIL -2000000001

int key[MAX];

int parent(int c);
int right(int c);
int left(int c);

int main(){
  int i, n, h;

  scanf("%d", &n);

  for(i = 0; i < MAX; i++){
    key[i] = NIL;
  }

  for(i = 0; i < n; i++){
    scanf("%d", &h);
    key[i] = h;
  }

  for(i = 0; i < n; i++){
    printf("node %d: key = %d, ", i+1, key[i]);
    if(key[parent(i)] != NIL && i != 0){
      printf("parent key = %d, ",key[parent(i)]);
    }
    if(MAX > left(i) &&  key[left(i)] != NIL){
      printf("left key = %d, ",key[left(i)]);
    }
    if(MAX > right(i) && key[right(i)] != NIL){
      printf("right key = %d, ",key[right(i)]);
    }
    printf("\n");
  }  
   
  return 0;
}

int parent(int c){
  return (c-1)/2;
}

int right(int c){
  return 2*c+2;
}

int left(int c){
  return 2*c+1;
}