ternary heap (analog of binary geap added)