using System; using System.Collections.Generic; namespace y { class Program { static void Main(string[] args) { var n = int.Parse(Console.ReadLine()); List> li = new List>(); for (int i = 0; i < 20; i++) { li.Add(new List()); } string ans = ""; for (int i = 0; i < n; i++) { var ss = Console.ReadLine().Split(); switch (ss[0]) { case "0": for (int j = 3; j < ss.Length; j++) { li[int.Parse(ss[1]) - 1].Add(ss[j]); } break; case "1": var f = false; for (int j = 0; j < li.Count; j++) { if (li[j].Contains(ss[1])) { li[j].Remove(ss[1]); ans += (j + 1).ToString() + "\n"; f = true; break; } } if (!f) { ans += "-1\n"; } break; case "2": li[int.Parse(ss[1]) - 1].Clear(); break; default: break; } } Console.WriteLine(ans); } } }