#include <stdio.h>
#define MAX 250
#define NIL -2000000001

int key[MAX];

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

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

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

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

  scanf("%d",&n);

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

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

  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;
}