using System.Linq; using System.Collections.Generic; using System; public class Hello { public static void Main() { var c = new List[20]; for (int i = 0; i < 20; i++) c[i] = new List(); var n = int.Parse(Console.ReadLine().Trim()); for (int i = 0; i < n; i++) { string[] line = Console.ReadLine().Trim().Split(' '); if (line[0] == "0") { var n1 = int.Parse(line[1]) - 1; var m1 = int.Parse(line[2]); for (int j = 0; j < m1; j++) c[n1].Add(line[j + 3]); } else if (line[0] == "1") { var neta = line[1]; var deleted = false; for (int j = 0; j < 20; j++) if (c[j].Count() > 0 && c[j].Contains(neta)) { c[j].Remove(neta); deleted = true; Console.WriteLine(j + 1); break; } if (!deleted) Console.WriteLine(-1); } else { var a = int.Parse(line[1]) - 1; c[a].Clear(); } } } }