#include<stdio.h>

#define INF 2000001

typedef struct node{
  int key;
  int parent;
  int left;
  int right;
}Node;

Node N[251];



int main() {
  int n,i,j,par,m=0;

  scanf("%d",&n);

  for(i=1;i<=n;i++){
    scanf("%d",&N[i].key);
  }
  for(i=1;i<=n;i++){
    N[i].left =N[2*i].key;
    N[i].right = N[2*i+1].key;
    if(i!=1){
      N[i].parent = N[i/2].key;
    }
  }

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

      else{
	printf("node %d: key = %d, parent key = %d, \n",i,N[i].key,N[i].parent);

      }
  }

  return 0;
}
	
      
      


