#include<stdio.h>
#include<stdlib.h>

int main(){
  int n;
  int i;
  int *A;

  scanf("%d",&n);

  A = malloc(sizeof(int)*(n+1));

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

  if(n>=3)
    printf("node 1: key = %d, left key = %d, right key = %d, \n",A[1],A[2],A[3]);
  else if(n==2)
    printf("node 1: key = %d, left key = %d, \n",A[1],A[2]);
  else
    printf("node 1: key = %d, \n",A[1]);

  for(i=2; i<n+1;i++){
    printf("node %d: key = %d, parent key = %d, ",i,A[i],A[i/2]);

    if(n>=i*2+1)
      printf("left key = %d, right key = %d, \n",A[i*2],A[i*2+1]);
    else if(n==i*2)
      printf("left key = %d, \n",A[i*2]);
    else 
      printf("\n");
  }
  return 0;
}