#include<stdio.h>

int main(){
  int H, A[100000 + 1] = {0}, id, k, pk, lk, rk, i;

  scanf("%d", &H);
  for(i = 1; i <= H; i++)
    scanf("%d", &A[i]);

  for(id = 1; id <= H; id++){
    printf("node %d: ", id);
    k = A[id];
    printf("key = %d, ", k);
    if(id / 2 != 0)
      printf("parent key = %d, ", A[id / 2]);
    lk = rk = id * 2;
    rk++;
    if(lk <= H){
      printf("left key = %d, ", A[lk]);
    }
    if(rk <= H){ 
      printf("right key = %d,\n", A[rk]);
    }else{
      printf("\n");
    }
  }
  return 0;
}