#include <stdio.h>
int a[249];

int p(int i){return i/2;}
int l(int i){return i*2;}
int r(int i){return i*2+1;}

int main(){
  
  int n,i;
  scanf("%d",&n);
  for(i=1;i<=n;i++)scanf("%d",&a[i]);
  for(i=1;i<=n;i++){
    printf("node %d: key = %d, ",i,a[i]);

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

