using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
class Plus
{
public void input()
{
StreamWriter sw = new StreamWriter(Console.OpenStandardOutput());
StreamReader sr = new StreamReader(Console.OpenStandardInput());
StringBuilder sb = new StringBuilder();
int w = int.Parse(sr.ReadLine());
(int x, string y,int z)[] list = new (int x, string y,int z)[w];
for (int i = 0; i < w; i++)
{
string[] a = sr.ReadLine().Split(' ');
list[i] = (int.Parse(a[0]), a[1],i);
}
var sortedlist = list.OrderBy(x => x.x).ThenBy(x => x.z).ToList();
for (int i = 0; i < w; i++)
{
sb.AppendLine($"{sortedlist[i].x} {sortedlist[i].y}");
}
sw.WriteLine(sb);
sw.Close();
sr.Close();
}
}
class main
{
static void Main(string[] args)
{
Plus plus = new Plus();
plus.input();
}
}
Linq하고 같이 쓰면 조건별로 정렬 뚝딱임