{"raw_statement":[{"iden":"statement","content":"You all know that the Library of Bookland is the largest library in the world. There are dozens of thousands of books in the library.\n\n_Some long and uninteresting story was removed..._\n\nThe alphabet of Bookland is so large that its letters are denoted by positive integers. Each letter can be small or large, the large version of a letter _x_ is denoted by _x_'. BSCII encoding, which is used everywhere in Bookland, is made in that way so that large letters are presented in the order of the numbers they are denoted by, and small letters are presented in the order of the numbers they are denoted by, but all large letters are **before** all small letters. For example, the following conditions hold: 2 < 3, 2' < 3', 3' < 2.\n\nA word _x_1, _x_2, ..., _x__a_ is not _lexicographically_ greater than _y_1, _y_2, ..., _y__b_ if one of the two following conditions holds:\n\n*   _a_ ≤ _b_ and _x_1 = _y_1, ..., _x__a_ = _y__a_, i.e. the first word is the prefix of the second word;\n*   there is a position 1 ≤ _j_ ≤ _min_(_a_, _b_), such that _x_1 = _y_1, ..., _x__j_ - 1 = _y__j_ - 1 and _x__j_ < _y__j_, i.e. at the first position where the words differ the first word has a smaller letter than the second word has.\n\nFor example, the word \"3' 7 5\" is before the word \"2 4' 6\" in lexicographical order. It is said that sequence of words is in lexicographical order if each word is not lexicographically greater than the next word in the sequence.\n\nDenis has a sequence of words consisting of small letters only. He wants to change some letters to large (let's call this process a _capitalization_) in such a way that the sequence of words is in lexicographical order. However, he soon realized that for some reason he can't change a single letter in a single word. He only can choose a letter and change all of its occurrences in **all** words to large letters. He can perform this operation any number of times with arbitrary letters of Bookland's alphabet.\n\nHelp Denis to choose which letters he needs to capitalize (make large) in order to make the sequence of words lexicographically ordered, or determine that it is impossible.\n\nNote that some words can be **equal**."},{"iden":"input","content":"The first line contains two integers _n_ and _m_ (2 ≤ _n_ ≤ 100 000, 1 ≤ _m_ ≤ 100 000) — the number of words and the number of letters in Bookland's alphabet, respectively. The letters of Bookland's alphabet are denoted by integers from 1 to _m_.\n\nEach of the next _n_ lines contains a description of one word in format _l__i_, _s__i_, 1, _s__i_, 2, ..., _s__i_, _l__i_ (1 ≤ _l__i_ ≤ 100 000, 1 ≤ _s__i_, _j_ ≤ _m_), where _l__i_ is the length of the word, and _s__i_, _j_ is the sequence of letters in the word. The words are given in the order Denis has them in the sequence.\n\nIt is guaranteed that the total length of all words is not greater than 100 000."},{"iden":"output","content":"In the first line print \"_Yes_\" (without quotes), if it is possible to capitalize some set of letters in such a way that the sequence of words becomes lexicographically ordered. Otherwise, print \"_No_\" (without quotes).\n\nIf the required is possible, in the second line print _k_ — the number of letters Denis has to capitalize (make large), and in the third line print _k_ distinct integers — these letters. Note that you **don't need to minimize** the value _k_.\n\nYou can print the letters in any order. If there are multiple answers, print any of them."},{"iden":"examples","content":"Input\n\n4 3\n1 2\n1 1\n3 1 3 2\n2 1 1\n\nOutput\n\nYes\n2\n2 3 \n\nInput\n\n6 5\n2 1 2\n2 1 2\n3 1 2 3\n2 1 5\n2 4 4\n2 4 4\n\nOutput\n\nYes\n0\n\nInput\n\n4 3\n4 3 2 2 1\n3 1 1 3\n3 2 3 3\n2 3 1\n\nOutput\n\nNo"},{"iden":"note","content":"In the first example after Denis makes letters 2 and 3 large, the sequence looks like the following:\n\n*   2'\n*   1\n*   1 3' 2'\n*   1 1\n\nThe condition 2' < 1 holds, so the first word is not lexicographically larger than the second word. The second word is the prefix of the third word, so the are in lexicographical order. As the first letters of the third and the fourth words are the same, and 3' < 1, then the third word is not lexicographically larger than the fourth word.\n\nIn the second example the words are in lexicographical order from the beginning, so Denis can do nothing.\n\nIn the third example there is no set of letters such that if Denis capitalizes them, the sequence becomes lexicographically ordered."}],"translated_statement":[{"iden":"statement","content":"众所周知，Bookland图书馆是世界上最大的图书馆，馆藏书籍达数万册。\n\n_一段冗长无趣的故事已被删除..._\n\nBookland的字母表如此庞大，以至于其字母用正整数表示。每个字母都有小写和大写形式，字母 #cf_span[x] 的大写形式记为 #cf_span[x']。Bookland广泛使用的BSCII编码规定：大写字母按其所代表的数字顺序排列，小写字母也按其所代表的数字顺序排列，但所有大写字母都位于所有小写字母之前。例如，以下条件成立：#cf_span[2 < 3]，#cf_span[2' < 3']，#cf_span[3' < 2]。\n\n单词 #cf_span[x1, x2, ..., xa] 不_字典序大于_ 单词 #cf_span[y1, y2, ..., yb]，当且仅当满足以下两个条件之一：\n\n例如，单词 \"#cf_span[3'] #cf_span[7] #cf_span[5]\" 在字典序上位于 \"#cf_span[2] #cf_span[4'] #cf_span[6]\" 之前。若序列中每个单词都不字典序大于其后一个单词，则称该单词序列处于字典序顺序。\n\nDenis有一个仅由小写字母组成的单词序列。他希望将某些字母改为大写（称此过程为_大写化_），使得单词序列变为字典序顺序。但他很快发现，出于某种原因，他不能单独更改一个单词中的一个字母。他只能选择一个字母，并将该字母在_所有_单词中的所有出现改为大写。他可以对Bookland字母表中的任意字母执行此操作任意多次。\n\n帮助Denis选择需要大写的字母，使得单词序列变为字典序顺序，或判断这是不可能的。\n\n注意：某些单词可以_相等_。\n\n第一行包含两个整数 #cf_span[n] 和 #cf_span[m] (#cf_span[2 ≤ n ≤ 100 000], #cf_span[1 ≤ m ≤ 100 000]) —— 分别表示单词数量和Bookland字母表中字母的数量。Bookland字母表的字母用从 #cf_span[1] 到 #cf_span[m] 的整数表示。\n\n接下来的 #cf_span[n] 行，每行描述一个单词，格式为 #cf_span[li, si, 1, si, 2, ..., si, li] (#cf_span[1 ≤ li ≤ 100 000], #cf_span[1 ≤ si, j ≤ m])，其中 #cf_span[li] 是单词长度，#cf_span[si, j] 是单词中的字母序列。单词按Denis序列中的顺序给出。\n\n保证所有单词的总长度不超过 #cf_span[100 000]。\n\n第一行输出 \"_Yes_\"（不含引号），如果存在某种方式大写化某些字母使得单词序列变为字典序顺序；否则输出 \"_No_\"（不含引号）。\n\n如果可行，第二行输出 #cf_span[k] —— Denis需要大写的字母数量，第三行输出 #cf_span[k] 个互不相同的整数 —— 这些字母。注意你_不需要最小化_ #cf_span[k] 的值。\n\n你可以按任意顺序输出这些字母。如果有多个答案，输出任意一个即可。\n\n在第一个例子中，Denis将字母 #cf_span[2] 和 #cf_span[3] 大写后，序列变为：\n\n条件 #cf_span[2' < 1] 成立，因此第一个单词不字典序大于第二个单词。第二个单词是第三个单词的前缀，因此它们处于字典序顺序。由于第三个和第四个单词的首字母相同，且 #cf_span[3' < 1]，因此第三个单词不字典序大于第四个单词。\n\n在第二个例子中，单词序列从一开始就是字典序顺序，因此Denis无需做任何操作。\n\n在第三个例子中，不存在任何字母集合，使得Denis将其大写后序列变为字典序顺序。"},{"iden":"input","content":"第一行包含两个整数 #cf_span[n] 和 #cf_span[m] (#cf_span[2 ≤ n ≤ 100 000], #cf_span[1 ≤ m ≤ 100 000]) —— 分别表示单词数量和Bookland字母表中字母的数量。Bookland字母表的字母用从 #cf_span[1] 到 #cf_span[m] 的整数表示。接下来的 #cf_span[n] 行，每行描述一个单词，格式为 #cf_span[li, si, 1, si, 2, ..., si, li] (#cf_span[1 ≤ li ≤ 100 000], #cf_span[1 ≤ si, j ≤ m])，其中 #cf_span[li] 是单词长度，#cf_span[si, j] 是单词中的字母序列。单词按Denis序列中的顺序给出。保证所有单词的总长度不超过 #cf_span[100 000]。"},{"iden":"output","content":"第一行输出 \"_Yes_\"（不含引号），如果存在某种方式大写化某些字母使得单词序列变为字典序顺序；否则输出 \"_No_\"（不含引号）。如果可行，第二行输出 #cf_span[k] —— Denis需要大写的字母数量，第三行输出 #cf_span[k] 个互不相同的整数 —— 这些字母。注意你_不需要最小化_ #cf_span[k] 的值。你可以按任意顺序输出这些字母。如果有多个答案，输出任意一个即可。"},{"iden":"examples","content":"输入4 31 21 13 1 3 22 1 1输出Yes22 3 输入6 52 1 22 1 23 1 2 32 1 52 4 42 4 4输出Yes0 输入4 34 3 2 2 13 1 1 33 2 3 32 3 1输出No"},{"iden":"note","content":"在第一个例子中，Denis将字母 #cf_span[2] 和 #cf_span[3] 大写后，序列变为： #cf_span[2'] #cf_span[1] #cf_span[1] #cf_span[3'] #cf_span[2'] #cf_span[1] #cf_span[1] 条件 #cf_span[2' < 1] 成立，因此第一个单词不字典序大于第二个单词。第二个单词是第三个单词的前缀，因此它们处于字典序顺序。由于第三个和第四个单词的首字母相同，且 #cf_span[3' < 1]，因此第三个单词不字典序大于第四个单词。在第二个例子中，单词序列从一开始就是字典序顺序，因此Denis无需做任何操作。在第三个例子中，不存在任何字母集合，使得Denis将其大写后序列变为字典序顺序。"}],"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ n, m \\in \\mathbb{Z}^+ $: number of words and alphabet size ($2 \\leq n \\leq 100{,}000$, $1 \\leq m \\leq 100{,}000$).  \nLet $ W = (w_1, w_2, \\dots, w_n) $ be the sequence of words, where each word $ w_i = (s_{i,1}, s_{i,2}, \\dots, s_{i,\\ell_i}) $ is a sequence of letters $ s_{i,j} \\in \\{1, 2, \\dots, m\\} $, all initially *small*.  \nLet $ C \\subseteq \\{1, 2, \\dots, m\\} $ be the set of letters to be *capitalized* (made large).  \n\nThe BSCII ordering is defined as:  \n- For any two letters $ a, b \\in \\{1, \\dots, m\\} $:  \n  - $ a' < b' $ if and only if $ a < b $,  \n  - $ a' < b $ for all $ a, b $,  \n  - $ a < b $ if and only if $ a < b $ (small letters ordered numerically).  \nThus, the total order is:  \n$$\n1' < 2' < \\dots < m' < 1 < 2 < \\dots < m\n$$\n\nA word $ w = (x_1, \\dots, x_p) $ is *lexicographically less than or equal* to $ w' = (y_1, \\dots, y_q) $ if:  \n- There exists an index $ k \\geq 1 $ such that $ x_i = y_i $ for all $ i < k $, and either $ x_k < y_k $ (under BSCII) or $ k = p+1 \\leq q $.  \n\n**Constraints**  \n1. $ \\sum_{i=1}^n \\ell_i \\leq 100{,}000 $  \n2. For each $ i \\in \\{1, \\dots, n-1\\} $, after applying capitalization $ C $, we require:  \n   $$\n   w_i \\leq_{\\text{BSCII}} w_{i+1}\n   $$\n\n**Objective**  \nDetermine whether there exists a set $ C \\subseteq \\{1, \\dots, m\\} $ such that the sequence $ W $ is lexicographically non-decreasing under BSCII ordering with letters in $ C $ capitalized.  \nIf yes, output any such $ C $.  \nIf no, output \"No\".","simple_statement":null,"has_page_source":false}