#include<stdio.h>
#define N 100000
int A[N+1];
void print(int,int);
int main(){
  int i,a;
  scanf("%d", &a);
  for(i = 1; i <= a; i++)
    scanf("%d", &A[i]);
  for(i = 1; i <= a; i++)
    print(i,a);

  return 0;
}

void print(int i, int a){
  printf("node %d: key = %d, ", i, A[i]);
  if(i / 2 >= 1)
    printf("parent key = %d, ", A[i/2]);
  if(i * 2 <= a)
    printf("left key = %d, ", A[i*2]);
  if(i * 2 + 1 <= a)
    printf("right key = %d, ", A[i*2+1]);

  printf("\n");
}


