#include<stdio.h>

#define N 250
#define NIL -1

typedef struct{
  int left,right,parent;
}heap;

int parent(int i){
  return i/2;
}

int left(int i){
  return 2*i;
}

int right(int i){
  return 2*i+1;
}

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

  scanf("%d",&n);

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

  for(i=0;i<n;i++){
    printf("node %d: key = %d, ",i+1,H[i]);

    if(parent(i+1)!=0) printf("parent key = %d, ",H[parent(i+1)-1]);

    if(left(i+1)<=n) printf("left key = %d, ",H[left(i+1)-1]);

    if(right(i+1)<=n) printf("right key = %d, ",H[right(i+1)-1]);

    printf("\n");
  }

  return 0;
}

