//config = { input: 'tmp', newline: '\r\n' }; // win
config = { input: '/dev/stdin', newline: '\n' }; // linux

A = require('fs').readFileSync(config.input, 'ascii')
  .split(config.newline, 2);
A = A[1].split(' ');
A.unshift(null);

template = new Array(14);
template[0] = 'node ';
template[1] = '[node number]';
template[2] = ': key = ';
template[3] = '[key number]';
template[4] = ', ';
template[5] = 'parent key = ';
template[6] = '[parent key number]';
template[7] = ', ';
template[8] = 'left key = ';
template[9] = '[left key number]';
template[10] = ', ';
template[11] = 'right key = ';
template[12] = '[right key number]';
template[13] = ', ';
res = [].concat(template);
for (i = 1; i < A.length; i++) {
  res[1] = i;
  res[3] = A[i];
  parent = Math.floor(i / 2);
  if (parent !== 0) {
    res[5] = template[5];
    res[6] = A[parent];
    res[7] = template[7];
  } else {
    res[5] = '', res[6] = ''; res[7] = '';
  }
  left = 2 * i;
  if (left < A.length) {
    res[8] = template[8];
    res[9] = A[left];
    res[10] = template[10];
  } else {
    res[8] = '', res[9] = '', res[10] = '';
  }
  right = 2 * i + 1;
  if (right < A.length) {
    res[11] = template[11];
    res[12] = A[right];
    res[13] = template[13];
  } else {
    res[11] = '';
    res[12] = '';
    res[13] = '';
  }
  console.log(res.join(''));
}