#include<stdio.h>

#define MAX 100000

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 i,p,l,r,H;
  int A[MAX];

    scanf("%d", &H);

  for(i=1;i<=H;i++){
    scanf("%d",&A[i]);
  }
  for(i=1;i<=H;i++){
    printf("node %d:",i);
    printf(" key = %d,",A[i]);
    p=parent(i);
    if(i!=1)printf(" parent key = %d,",A[p]);
    l=left(i);
    r=right(i);
    if(l<=H)printf(" left key = %d,",A[l]);
    if(r<=H)printf(" right key = %d,",A[r]);
    printf(" \n");

  }

  return 0;
}

