// (function main(){
//   const lines = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n');
//   const n = Number(lines.shift());
//   lines.shift().split(' ').map(Number).forEach(function(key, i, a) {
//     console.log(`node ${i+1}: key = ${a[i++]}, `+((i-1)?`parent key = ${a[Math.floor(i/2)-1]}, `:'')+(2*i-1<a.length?`left key = ${a[2*i-1]}, `:'')+(2*i<a.length?`right key = ${a[2*i]}, `:''));
//   });
// })();

require('fs').readFileSync('/dev/stdin', 'utf8').trim().split(' ').slice(1).map(Number).forEach((k,i,a)=>console.log(`node ${++i}: key = ${k}, `+((i-1)?`parent key = ${a[Math.floor(i/2)-1]}, `:'')+(2*i-1<a.length?`left key = ${a[2*i-1]}, `:'')+(2*i<a.length?`right key = ${a[2*i]}, `:'')))

