#include<stdio.h>
#define MAX 10000

int Parent(int n){
  return n/2;
}

int Left(int n){
  return 2*n;
}

int Right(int n){
  return 2*n+1;
}
int main()
{
  int n,i,A[MAX];

  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(Parent(i) >=1)printf("parent key = %d,",A[Parent(i)]);
    if(Left(i)<=n) printf("left key = %d, ",A[Left(i)]);
    if(Right(i)<=n) printf("right key = %d, ",A[Right(i)]);
    printf("\n");
  }
  return 0;
}
      

