#include <stdio.h>
#define MAX 255

int tree[MAX], h;
void print();

int main(){
  int a;

  scanf("%d",&h);
  for(a = 1; a <= h; a++){
    scanf("%d",&tree[a]);
  }

  print();
  return 0;
}

void print(){
  int a=1;

  for(a = 1; a <= h; a++){
    printf("node %d: key = %d, ",a,tree[a]);
    if(a/2 > 0 && a/2 <= h) printf("parent key = %d, ",tree[a/2]);
    if(2*a > 0 && 2*a <= h) printf("left key = %d, ",tree[2*a]);
    if(2*a+1 > 0 && 2*a+1 <= h) printf("right key = %d, ",tree[2*a+1]);
    printf("\n");
  }
}

