A9.com interview question

OOD, tree, database