#include <stdio.h>

int main(){

  int H, i, tree[100001];

  scanf("%d", &H);

  for(i=1; i<=H; i++){

    scanf("%d", &tree[i]);
  }

  for(i=1; i<=H; i++){

    printf("node %d: key = %d, ", i, tree[i]);

    if(i/2>=1){

      printf("parent key = %d, ", tree[i/2]);
    }

    if(2*i<=H){

      printf("left key = %d, ", tree[2*i]);
    }

    if(2*i+1<=H){

      printf("right key = %d, ",tree[2*i+1]);
    }

    printf("\n");

  }

  return 0;
}

