#include <stdio.h>
#define MAX 255
int parent(int i){
  int u;
  u=i/2;
  return u;
}
int left(int i){
    int u;
    u=2*i;
  return u;
}
int right(int i){
    int u;
    u=2*i+1;
  return u;
}

int main(){
  int i,p,l,r,H,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;
}


