#include <stdio.h>

int main(){
  int i,n;
  int tree[250];

  scanf("%d",&n);

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

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

  return 0;
}