#include<stdio.h>

#define MAX 250

struct node{
  int key;
};

int l;

int Parent(int i){
  if(i == 1) return 0;
  return i / 2;
}

int Left(int i){
  if(l < (2 * i)) return 0;
  else return 2 * i;
}

int Right(int i){
  if(l < (2 * i + 1)) return 0;
  return (2 * i) + 1;
}

int main(){
  int i;
  struct node h[MAX];

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

  for(i = 1; i <= l; i++){
    printf("node %d: key = %d, ",i,h[i].key);
    if(Parent(i) != 0)
      printf("parent key = %d, ",h[Parent(i)].key);
    if(Left(i) != 0)
      printf("left key = %d, ",h[Left(i)].key);
    if(Right(i) != 0)
      printf("right key = %d, ",h[Right(i)].key);
    printf("\n");
  }
  
  return 0;
}

