#include<stdio.h>
#define MAX 250
int parent(int);
int left(int);
int right(int);
int main(){
  int a[MAX+1],i,n;
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&a[i]);
  }
  for(i=1;i<=n;i++){
    printf("node %d: ",i);
    printf("key = %d, ",a[i]);
    if(parent(i)>=1)
      printf("parent key = %d, ",a[parent(i)]);
    if(left(i)<=n)
      printf("left key = %d, ",a[left(i)]);
    if(right(i)<=n)
      printf("right key = %d, ",a[right(i)]);
    printf("\n");
	}
  return 0;
}
int parent(int x){
  return x/2;
}

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

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

