using System; using System.Collections.Generic; using System.Text; using System.Linq; class Program { public void Proc() { Reader.IsDebug = false; int[] inpt = Reader.ReadLine().Split(' ').Select(a=>int.Parse(a)).ToArray(); long[] aList = Reader.ReadLine().Split(' ').Select(a=>long.Parse(a)).OrderBy(a=>a).ToArray(); Dictionary aCnt = new Dictionary(); aList.ToList().ForEach(a=>{ if(aCnt.ContainsKey(a)) { aCnt[a]++; } else { aCnt.Add(a, 1); } }); aList = aCnt.Keys.ToArray(); Dictionary bList = new Dictionary(); Reader.ReadLine().Split(' ').Select(a=>long.Parse(a)).ToList().ForEach(b=>bList.Add(bList.Count, b)); Dictionary cList = new Dictionary(); int currentIdx = 0; bList.OrderBy(a=>a.Value).ToList().ForEach((a)=>{ int cnt = 0; for(int i=currentIdx; ia.Key).ToList().ForEach(a=>ans.Append(" " + a.Value)); Console.WriteLine(ans.ToString().Substring(1)); } public class Reader { public static bool IsDebug = true; private static String PlainInput = @" 2 2 0 1000000000000 0 1000000000000 "; private static System.IO.StringReader Sr = null; public static string ReadLine() { if (IsDebug) { if (Sr == null) { Sr = new System.IO.StringReader(PlainInput.Trim()); } return Sr.ReadLine(); } else { return Console.ReadLine(); } } } static void Main() { Program prg = new Program(); prg.Proc(); } }