const line = require('fs').readFileSync('/dev/stdin', 'utf-8').split('\n');

const data = line[1].split(' ').map(Number);

data.map((x, i, arr) => {
    const p = Math.floor((i+1) / 2);
    const l = (i+1) * 2;
    const r = l + 1;

    const pStr = p > 0 ? `parent key = ${arr[p-1]}, ` : '';
    const lStr = l <= arr.length ? `left key = ${arr[l-1]}, ` : '';
    const rStr = r <= arr.length ? `right key = ${arr[r-1]}, ` : ''

    return [`node ${i+1}: key = ${x}, `, pStr, lStr, rStr].join('');
})
.forEach(x => console.log(x));

