{"raw_statement":[{"iden":"statement","content":"Alex works as a developer, and he has hard times now. He has to complete n tasks. Every task i has the latest time di when it can be completed (starting from the moment of time 0), the time ci needed to complete it, and the tasks that must be completed before task i to get the possibility to start it. We'll say that the i-th task depends on these tasks.\n\nWhat should be the order of doing tasks to complete all of them in time?\n\nThe first line contains a single integer n (1 ≤ n ≤ 200000) — the number of tasks.\n\nNext n lines describe tasks. The i-th line starts with three space-separated integers di, ci and ri (1 ≤ di,  ci ≤ 109,  0 ≤ ri ≤ n - 1) — the latest time to complete the i-th task, the time needed to complete it and the number of tasks which it depends on. Then in the same line ri space-separated integers — the numbers of these tasks — are written. It's guaranteed that there is no number i among these ri numbers.\n\nThe tasks are numbered from 1 in order of their appearance in the input. The sum of all ri in the input doesn't exceed 200000.\n\nIn the first line output «_YES_» (without quotes) if Alex will be able to complete all the tasks without exceeding any deadlines, or «_NO_» (without quotes) otherwise.\n\nIf the answer is «_YES_», in the second line output n space-separated integers — the numbers of tasks in the order they must be done to fit into all deadlines. If there are many solutions, output any of them.\n\n"},{"iden":"input","content":"The first line contains a single integer n (1 ≤ n ≤ 200000) — the number of tasks.Next n lines describe tasks. The i-th line starts with three space-separated integers di, ci and ri (1 ≤ di,  ci ≤ 109,  0 ≤ ri ≤ n - 1) — the latest time to complete the i-th task, the time needed to complete it and the number of tasks which it depends on. Then in the same line ri space-separated integers — the numbers of these tasks — are written. It's guaranteed that there is no number i among these ri numbers.The tasks are numbered from 1 in order of their appearance in the input. The sum of all ri in the input doesn't exceed 200000."},{"iden":"output","content":"In the first line output «_YES_» (without quotes) if Alex will be able to complete all the tasks without exceeding any deadlines, or «_NO_» (without quotes) otherwise.If the answer is «_YES_», in the second line output n space-separated integers — the numbers of tasks in the order they must be done to fit into all deadlines. If there are many solutions, output any of them."},{"iden":"examples","content":"Input310 5 02 2 05 3 0OutputYES2 3 1Input2100 1 010 10 1 1OutputNOInput2100 1 1 2200 2 1 1OutputNO"}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ n \\in \\mathbb{Z}^+ $ be the number of tasks.  \nFor each task $ i \\in \\{1, \\dots, n\\} $:  \n- $ d_i \\in \\mathbb{Z}^+ $: deadline (latest completion time).  \n- $ c_i \\in \\mathbb{Z}^+ $: processing time.  \n- $ r_i \\in \\mathbb{Z}_{\\geq 0} $: number of prerequisites.  \n- $ P_i = \\{p_{i,1}, \\dots, p_{i,r_i}\\} \\subseteq \\{1, \\dots, n\\} \\setminus \\{i\\} $: set of prerequisite tasks.  \n\nLet $ G = (V, E) $ be a directed graph where $ V = \\{1, \\dots, n\\} $ and $ E = \\{(j, i) \\mid j \\in P_i\\} $.\n\n**Constraints**  \n1. $ 1 \\leq n \\leq 200000 $  \n2. $ 1 \\leq d_i, c_i \\leq 10^9 $  \n3. $ 0 \\leq r_i \\leq n-1 $  \n4. $ \\sum_{i=1}^n r_i \\leq 200000 $  \n5. $ G $ is a DAG (no task depends on itself, and no cycles are present).  \n\n**Objective**  \nDetermine if there exists a topological ordering $ \\pi = (\\pi_1, \\dots, \\pi_n) $ of $ G $ such that, for all $ k \\in \\{1, \\dots, n\\} $, the completion time of task $ \\pi_k $ satisfies:  \n$$\n\\sum_{j=1}^k c_{\\pi_j} \\leq d_{\\pi_k}\n$$  \nIf such an ordering exists, output \"YES\" and one such $ \\pi $; otherwise, output \"NO\".","simple_statement":"Alex has n tasks. Each task i has:  \n- a deadline di (must finish by time di),  \n- a duration ci (takes ci time to complete),  \n- and ri prerequisite tasks that must be done before it.  \n\nFind an order to complete all tasks so that:  \n- all prerequisites are done before a task starts,  \n- every task finishes by its deadline.  \n\nIf possible, output \"YES\" and any valid order.  \nIf not, output \"NO\".","has_page_source":false}