#include<stdio.h>
#define MAX 100000

int main(){
	int n, i;
	int t[MAX];
  
	scanf("%d", &n);
	for ( i = 1; i <= n; i++ ) {
		scanf("%d", &t[i]);
	}
	
	for ( i = 1; i <= n; i++ ) {
		printf("node %d: key = %d, ", i, t[i]);
		if ( i / 2 >= 1 ){
			printf("parent key = %d, ", t[i/2]);
		} if ( i*2 <= n ) {
			printf("left key = %d, ", t[i*2]);
		} if ( i*2+1 <= n ) {
			printf("right key = %d, ", t[i*2+1]);
		}printf("\n");
	}
	
	return 0;
}
