{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"考虑一个无限完全二叉搜索树(见下图),节点中的数字为1, 2, 3, .... 在以X为根节点的子树中,我们可以通过重复向左节点下降直到最后一层来获得该子树中的最小数字,也可以通过向右节点下降来找到最大数字。现在给定一些查询,格式为“以X为根节点的子树中的最小和最大数字分别是多少?” 请尝试为这些查询找到答案。\r\u003cbr\u003e\u003ccenter\u003e\u003cimg src\u003d\"CDN_BASE_URL/d256767616c72653884bcc998150dab4?v\u003d1704172333\"\u003e\u003c/center\u003e"}},{"title":"输入","value":{"format":"HTML","content":"在输入中,第一行包含一个整数N,表示查询的数量。接下来的N行,每行包含一个数字,表示以数字X为根的子树(1 \u0026lt;\u003d X \u0026lt;\u003d 2\u003csup\u003e31\u003c/sup\u003e - 1)。"}},{"title":"输出","value":{"format":"HTML","content":"共有N行,第i行包含第i个查询的答案。"}},{"title":"示例","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e2\r\n8\r\n10\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1 15\r\n9 11\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}}]}