#include<stdio.h>

int p(int);
int l(int);
int r(int);

int main(){
  int key,i,a[100001];

  scanf("%d",&key);

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

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

    if(p(i+1)>=1) printf("parent key = %d, ",a[p(i+1)]);
    if(l(i+1)<=key) printf("left key = %d, ",a[l(i+1)]);
    if(r(i+1)<=key) printf("right key = %d, ",a[r(i+1)]);

    printf("\n");
  }
    
  return 0;
}

int p(int n){
  return n/2;
}

int l(int n){
  return 2*n;
}

int r(int n){
  return 2*n+1;
}

