Harryxun/stf_run huggingface dataset:
#
# abc082 b
#
import unittest
from io import StringIO
import sys


def input():
    return sys.stdin.readline().rstrip()


def resolve():
    s = list(input())
    t = list(input())

    flag = False
    s = sorted(s, reverse=True)
    t = sorted(t, reverse=True)
    for i in range(len(s)):
        if s[i] < t[i]:
            flag = True
            break
        elif s[i] == t[i] and len(s) < len(t):
            flag = True
            break

    if flag == True:
        print("Yes")
    else:
        print("No")


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """yx
axy"""
        output = """Yes"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """ratcode
atlas"""
        output = """Yes"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """cd
abc"""
        output = """No"""
        self.assertIO(input, output)

    def test_入力例_4(self):
        input = """w
ww"""
        output = """Yes"""
        self.assertIO(input, output)

    def test_入力例_5(self):
        input = """zzz
zzz"""
        output = """No"""
        self.assertIO(input, output)


if __name__ == "__main__":
    #unittest.main()
    resolve()


### FIXED CODE ###

#
# abc082 b
#
import unittest
from io import StringIO
import sys


def input():
    return sys.stdin.readline().rstrip()


def resolve():
    s = list(input())
    t = list(input())

    flag = False
    s = sorted(s)
    t = sorted(t, reverse=True)

    if s < t:
        print("Yes")
    else:
        print("No")


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """yx
axy"""
        output = """Yes"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """ratcode
atlas"""
        output = """Yes"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """cd
abc"""
        output = """No"""
        self.assertIO(input, output)

    def test_入力例_4(self):
        input = """w
ww"""
        output = """Yes"""
        self.assertIO(input, output)

    def test_入力例_5(self):
        input = """zzz
zzz"""
        output = """No"""
        self.assertIO(input, output)


if __name__ == "__main__":
    # unittest.main()
    resolve()
N = int(input())
A = list(map(int, input().split()))

for i in N:
  ans *= A[i]
  
print(ans)

### FIXED CODE ###

def main():
    N = int(input())
    A = list(map(int, input().split()))
 
    if 0 in A:
        print(0)
        return
    
    ans = 1
 
    for i in A:
        ans *= i
      
        if ans > 10 ** 18:
            print(-1)
            return 
      
    print(ans)  

main()
N,C,K = map(int,input().split())
T = []
for _ in range(N):
    t = int(input())
    T.append(t)
T.sort()
angry = 0
ans = 0
c = 0
for i in T:
    if angry == 0:
        angry = i + K
    c += 1
    if i >= angry :
        #print(i,angry)
        angry = i + K
        ans += 1
        c = 1
    if c == C:
        angry = 0
        ans += 1
        c = 0
    #print(ans,angry,c)
if c > 0:
    ans += 1
if C == 1:
    ans = C
print(ans)  

### FIXED CODE ###

N,M = map(int,input().split())
X = list(map(int,input().split()))
X.sort()
if M <= N :
    ans = 0
else:
    Y = []
    for i in range(M-1):
        Y.append(X[i+1] - X[i])
    Y.sort(reverse=True)
    ans = X[-1] - X[0]
    Y = Y[:N-1]
    for i in Y:
        ans -= i
print(ans)
import argparse

def make_parser():
    parser = argparse.ArgumentParser

    parser.add_argument('S')
    parser.add_argument('T')

    args = parser.parse_args()

    return args

def main():
    args = make_parser()
	T = arg.T
    S = arg.S
    
    printf(S + T)


if __name__ == "__main__":
    main()


### FIXED CODE ###

S,T = map(str, input().split())
print(T + S)
a,b,k = map(int,input().split())
n = b - a + 1
if n <= k*2:
  for i in range(a,b+1):
    print(i)
else:
  for i in range(a,k+1):
    print(i)
  fot j in range(b-k+1,b+1)
  print(j)


### FIXED CODE ###

a,b,k = map(int,input().split())
n = b - a + 1
if n <= k*2:
  for i in range(a,b+1):
    print(i)
else:
  for i in range(a,a+k):
    print(i)
  for j in range(b-k+1,b+1):
     print(j)
from collections import defaultdict
n = int(input())
v = list(map(int, input().split()))
o = defaultdict(int)
e = defaultdict(int)
odd_num = 0
even_num = 0
for i, v_one in enumerate(v):
  if i % 2 == 1:
    o[v_one] += 1
    odd_num += 1
  else:
    e[v_one] += 1
    even_num += 1
sorted_o = sorted(o.items(), key=lambda x:-x[1])
sorted_e = sorted(e.items(), key=lambda x:-x[1])
if sorted_o[0][0] != sorted_e[0][0]:
  ans = odd_num - sorted_o[0][1] + even_num - sorted_e[0][1]
else:
  ans1 = odd_num - sorted_o[1][1] + even_num - sorted_e[0][1]
  ans2 = odd_num - sorted_o[0][1] + even_num - sorted_e[1][1]
  ans = min(ans1, ans2)
print(ans)

### FIXED CODE ###

from collections import defaultdict
n = int(input())
v = list(map(int, input().split()))
o = defaultdict(int)
e = defaultdict(int)
odd_num = 0
even_num = 0
for i, v_one in enumerate(v):
  if i % 2 == 1:
    o[v_one] += 1
    odd_num += 1
  else:
    e[v_one] += 1
    even_num += 1
sorted_o = sorted(o.items(), key=lambda x:-x[1])
sorted_e = sorted(e.items(), key=lambda x:-x[1])
if sorted_o[0][0] != sorted_e[0][0]:
  ans = odd_num - sorted_o[0][1] + even_num - sorted_e[0][1]
elif len(sorted_o) >= 2 and len(sorted_e) >= 2:
  ans1 = odd_num - sorted_o[1][1] + even_num - sorted_e[0][1]
  ans2 = odd_num - sorted_o[0][1] + even_num - sorted_e[1][1]
  ans = min(ans1, ans2)
elif len(sorted_o) >= 2:
  ans = sorted_o[0][1]
elif len(sorted_e) >=2:
  ans = sorted_e[0][1]
else:
  ans = odd_num
print(ans)
import sys
sys.setrecursionlimit(10**6)

def pow_k(x, n):
    if n == 0:
        return 1

    K = 1
    while n > 1:
        if n % 2 != 0:
            K *= x
        x *= x
        n //= 2

    return K * x

n = int(input())
x = list(input())

popcount = [0] * (10**5 + 1)
for i in range(10**5+1):
    popcount[i] = format(i, 'b').count('1')

counter = x.count('1')
number = int(''.join(x), 2)

def f(num, cnt):
    if num == 0:
        return cnt
    return f(num % popcount[num], cnt+1)

for i in range(n):    
    if x[i] == '0':
        m = number + pow_k(2, n-i-1)
        print(f(m % (counter+1), 1))
    if x[i] == '1':
        m = number - pow_k(2, n-i-1)
        print(f(m % (counter-1), 1))

### FIXED CODE ###

n = int(input())
x = list(input())

count = x.count('1')
one_count = count - 1
zero_count = count + 1

one_mod = 0
zero_mod = 0
for b in x:
    if one_count:
        one_mod = (one_mod * 2 + int(b)) % one_count
    zero_mod = (zero_mod * 2 + int(b)) % zero_count

f = [0] * 2000001
pop_count = [0] * 200001
for i in range(1, 200001):
    pop_count[i] = pop_count[i//2] + i % 2
    f[i] = f[i % pop_count[i]] + 1

for i in range(n):
    if x[i] == '1':
        if one_count:
            nxt = one_mod
            nxt -= pow(2, n-i-1, one_count)
            nxt %= one_count
            print(f[nxt] + 1)
        else:
            print(0)
    if x[i] == '0':
        nxt = zero_mod
        nxt += pow(2, n-i-1, zero_count)
        nxt %= zero_count
        print(f[nxt] + 1)
n=int(input())

ans='No'

if n//100==7 or n//10==7 or n%10==7:
    ans='Yes'
elif :
    ans='No'
print(ans)

### FIXED CODE ###

n=input()

ans='No'

if '7' in n:
    ans='Yes'
print(ans)
class SegTree(object):
  def __init__(self,op,e,n,init_val):
    self.num = 1<<(300000-1).bit_length() 
    self.S = [e]*self.num*2
    self.op = op
    self.e = e
    for i,v in enumerate(init_val): self.S[self.num+i] = v
    for i in range(self.num-1,0,-1):
      self.S[i] = self.op(self.S[i*2], self.S[i*2+1])
  def set(self,index,value):
    idx = self.num+index
    self.S[idx] = value
    while idx>0:
      self.S[idx>>1] = self.op(self.S[idx],self.S[idx^1])
      idx>>=1
  def prod(self,l,r):
    res = self.e
    r += self.num
    l += self.num
    while l<r:
      if l&1:
        res = self.op(res,self.S[l])
        l += 1
      if r&1:
        res = self.op(self.S[r-1],res)
      l >>= 1
      r >>= 1
    return res
        
N,K = map(int,input().split())
ST = SegTree(max,0,300000,[0]*300000)
ans = 1
for i in range(N):
  A = int(input())
  v = ST.prod(A-K,A+K+1)+1
  ans = max(ans,v)
  ST.set(A,v)
print(ans)

### FIXED CODE ###

class SegTree(object):
  def __init__(self,op,e,n,init_val):
    self.num = 1<<(n-1).bit_length() 
    self.S = [e]*self.num*2
    self.op = op
    self.e = e
    for i,v in enumerate(init_val): self.S[self.num+i] = v
    for i in range(self.num-1,0,-1):
      self.S[i] = self.op(self.S[i*2], self.S[i*2+1])
      
  def set(self,index,value):
    idx = self.num+index
    self.S[idx] = value
    while idx>0:
      self.S[idx>>1] = self.op(self.S[idx],self.S[idx^1])
      idx>>=1
      
  def prod(self,l,r):
    res = self.e
    l = max(0,l)+self.num
    r = min(r,self.num-1)+self.num
    while l<r:
      if l&1:
        res = self.op(res,self.S[l])
        l += 1
      if r&1:
        res = self.op(self.S[r-1],res)
      l >>= 1
      r >>= 1
    return res
        
N,K = map(int,input().split())
ST = SegTree(max,0,300001,[0]*300001)
ans = 1
for i in range(N):
  A = int(input())
  l,r = max(0,A-K),min(A+K,300000)
  v = ST.prod(l,r+1)+1
  ans = max(ans,v)
  ST.set(A,v)
print(ans)
import collections
#入力
N = int(input())

dp = [[0]* 101 for _ in range(101)] #101×101の盤面
check = [[None]* 101 for _ in range(101)] #101×101の盤面　重ね合わせた結果に利用
#print (dp)
lst = []
for i in range(N):
    x, y, z = map(int, input().split())
    lst += [[x, y, z]]
    dp[x][y] = z

#print (lst)
#print (dp)

move = [[-1,0], [1, 0], [0, -1],[0, 1]]
def bfs(x, y, h):
    dp2 = [[-1]* 101 for _ in range(101)] #101×101の盤面　bfsするときに訪れたかどうかの判定に利用
    dp2[x][y] = h #bfsのスタート地点を記入
    if check[x][y] == None: #重ね合わせた結果が入っていない場合、記録する
        check[x][y] = h
    elif dp2[x][y] != check[x][y]:
        check[x][y] = -10
    #print ('check', check)
    q = collections.deque()
    q.append([x, y]) #スタート地点をqueueに記録
    #print (q)
    while True: #常にループ
        #print ('True') 
        if not q: #dequeが空になっていたら終わる
            #print (q)
            #print ('dp2', dp2)
            return 'B'
        else: #deque内に要素が入っているとき
            px, py = q.popleft() #要素を1組取り出す
            for dx, dy in move:
                nx = px + dx
                ny = py + dy
                if 0 <= nx and nx <101 and 0 <= ny and ny < 101: #範囲内の確認
                    if dp2[nx][ny] == -1: #初めて訪れる時
                        if check[nx][ny] == None: #checkが入っていないとき
                            check[nx][ny] = dp2[px][py] + 1 #移動前のマス+1が移動先の値
                            dp2[nx][ny] = dp2[px][py] + 1 #移動前のマス+1が移動先の値
                            q.append([nx, ny]) #移動先の地点を表す組をdequeに記録
                            #print (check)
                            #print ('C')
                        else: #checkが入っているとき
                            #print ('D')
                            dp2[nx][ny] = dp2[px][py] + 1
                            if dp2[nx][ny] == check[nx][ny]: #今回求めたdp2と記録されているcheckが等しい時
                                #print ('(nx, ny)', nx, ny)
                                pass
                            else: #一致しない時
                                check[nx][ny] = -10
                            q.append([nx, ny])
    return 'A'

#print (bfs(2, 3, 5))
#print (bfs(2, 1, 5))
#print (bfs(1, 2, 5))
#print (bfs(3, 2, 5))

for h in range(N):
    a, b, c = lst[h]
    bfs(a, b, c)

ans = 0
for i in range(101):
    for j in range(101):
        if ans < check[i][j]:
            ans = max(ans, check[i][j])
            ans_x, ans_y = i, j

print (ans_x, ans_y, ans)
#print (check)

### FIXED CODE ###

import sys
N = int(input())

lst = []
for i in range(N):
    a = list(map(int, input().split()))
    lst += [a]

#print (lst)

#中心座標(px, py)
for px in range(101):
    for py in range(101):
#        print ('px, py ', px, py)
        j = 0
        while lst[j][2] == 0:
            j += 1
        h = lst[j][2] + abs(px-lst[j][0]) + abs(py -lst[j][1])
#        print ('j, h ', j, h)
        k = 0
        while k < N:
            if lst[k][2] == max(h - abs(px-lst[k][0]) - abs(py -lst[k][1]), 0):
                k += 1
#                print ('A')
            else:
#                print ('B')
                k = 10 ** 9
        if k == N:
            print (px, py, h)
            sys.exit()
        else:
            pass
#            print ('C')
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define uint unsigned int
#define ull  unsigned long long
typedef string str;
typedef long long ll;
typedef double db;
typedef pair<int, int> pii;
typedef map<int, int> mii;
typedef vector<int> vi;
typedef vector<bool> vb;
#define pb push_back
#define fi first
#define se second
#define in insert
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
const int INF = 1e9 + 5;
const int N = 2e5 + 1;
int a[N][N];
int main(){
    speed;
    int n, m;
    cin >> n >> m;
    for(int i = 0; i < m; ++i){
        int x, y;
        cin >> x >> y;
        a[x][y] = 1;
    }
    for(int i = 0; i < N; ++i){
        if(a[1][i] && a[i][n]){
            cout << "POSSIBLE";
            return 0;
        }
    }
    cout << "IMPOSSIBLE";
}

### FIXED CODE ###

a=[]
b={}
n,m=map(int,input().split())
for _ in range(m):
	i,j=map(int,input().split())
	if i==1:
		a.append(j)
	elif j==n:
		b[i]=1
for i in a:
	if i in b:
		print('POSSIBLE')
		break
else:
	print('IMPOSSIBLE')
N=int(input())
ans = []
for i in range(1,N+1):
    if i % 3 == 0 and i % 5 == 0:
        continue
    elif i % 3 == 0 and i % 5 != 0:
        continue
    elif i % 5 == 0 and i % 3 != 0:
        continue
    else:
        ans.appned(i)
print(sum(ans))


### FIXED CODE ###

N=int(input())
ans = []
for i in range(1,N+1):
    if i % 3 == 0 and i % 5 == 0:
        continue
    elif i % 3 == 0 and i % 5 != 0:
        continue
    elif i % 5 == 0 and i % 3 != 0:
        continue
    else:
        ans.append(i)
print(sum(ans))
a,b,c,d=list(map(int,input().split()))
print(((c-a)**2+(b-d)**2)**.5)

### FIXED CODE ###

a,b,c,d=list(map(float,input().split()))
print('%.5f'%(((c-a)**2+(b-d)**2)**.5))
import sys
sys.setrecursionlimit(10 ** 7)

def dfs(s):
    if visited[s]:
        return
    visited[s] = 1
    for to in t[s]:
        if visited[to]:
            continue
        dfs(to)
    
N, M = map(int,input().split())
t = [[] for _ in range(N)]
visited = [0] * N
for _ in range(M):
    X, Y, Z = map(int,input().split())
    X -= 1
    Y -= 1
    t[X].append(Y)
    t[Y].append(X)
ans = 0
for i in range(1, N + 1):
    if visited[i]:
        continue
    ans += 1
    dfs(i)
print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 7)

def dfs(s):
    if visited[s]:
        return
    visited[s] = 1
    for to in t[s]:
        if visited[to]:
            continue
        dfs(to)
    
N, M = map(int,input().split())
t = [[] for _ in range(N)]
visited = [0] * N
for _ in range(M):
    X, Y, Z = map(int,input().split())
    X -= 1
    Y -= 1
    t[X].append(Y)
    t[Y].append(X)
ans = 0
for i in range(0, N):
    if visited[i]:
        continue
    ans += 1
    dfs(i)
print(ans)
#!/usr/bin/env python3
import sys

MOD = 2019  # type: int

def solve(L: int, R: int):
    #if R - L >= 2019 - 1:
    if R % 2019 < L % 2019:
        print(0)
    else:
        L = L % 2019
        R = R % 2019
        
        smallest = 10000000
        for i in range(L, R):
            for j in range(i+1, R+1):
                calc = (i*j)%2019
                if calc < smallest:
                    smallest = calc
    print(smallest)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    L = int(next(tokens))  # type: int
    R = int(next(tokens))  # type: int
    solve(L, R)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys

MOD = 2019  # type: int

def solve(L: int, R: int):
    if R - L >= 2019 - 1:
        print(0)
        return
    if R % 2019 <= L % 2019:
        print(0)
        return
    else:
        L = L % 2019
        R = R % 2019
        
        smallest = 10000000
        for i in range(L, R):
            for j in range(i+1, R+1):
                calc = (i*j)%2019
                if calc < smallest:
                    smallest = calc
    print(smallest)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    L = int(next(tokens))  # type: int
    R = int(next(tokens))  # type: int
    solve(L, R)

if __name__ == '__main__':
    main()
def isReach( goal, move ):
    msum = sum(move)
    m = len(move)
    dp = [[False]*(msum*2+2) for i in range(m+1)]
    dp[0][0] = True

    for i in range(m):
        for j in range(-msum,msum+1):
            if dp[i][j]:
                dp[i+1][j-move[i]] = True
                dp[i+1][j+move[i]] = True
    
    return dp[m][goal]

s = list( input().split('T') )
x,y = map( int, input().split() )

move_dist = [len(move) for move in s]
x_move = move_dist[0::2]
y_move = move_dist[1::2]

if isReach(x,x_move) and isReach(y,y_move):
    print('Yes')
else:
    print('No')

### FIXED CODE ###

def isReach( goal, move, is_x):
    msum = sum(move)
    m = len(move)

    if msum < abs(goal):
        return False

    dp = [[False for _ in range(msum*2+1)] for _ in range(m+1)]
    dp[0][0] = True
    
    for i in range(m):
        for j in range(-msum,msum+1):
            if i == 0 and dp[i][j] and is_x:
                dp[i+1][j+move[i]] = True
            elif dp[i][j]:
                dp[i+1][j-move[i]] = True
                dp[i+1][j+move[i]] = True
    
    return dp[m][goal]


s = list( input().split('T') )
x,y = map( int, input().split() )

move_dist = [len(move) for move in s]
x_move = move_dist[0::2]
y_move = move_dist[1::2]

if isReach(x,x_move,True) and isReach(y,y_move,False):
    print('Yes')
else:
    print('No')
N = int(input())
P = list(map(int, input().split()))
ans = 0

for i in range(N):
    tmp_P = P[:i]
    if min(tmp_P) >= P[i]:
        ans += 1

print(ans)

### FIXED CODE ###

N = int(input())
P = list(map(int, input().split()))
ans = 1

min_P = P[0]

for i in range(1, N):
    if min_P >= P[i]:
        ans += 1
        min_P = P[i]

print(ans)
MOD=10**9+7
import bisect
N,K=[int(s) for s in input().split()]
ls=[int(s) for s in input().split()]
ans=set()
if 0 in ls:
  ans.add(0)

als=sorted(ls, key=lambda x: -abs(x))
mul=1
for i in range(K):
  mul*=als[i]
if mul>0:
  print(mul%MOD)
else:
  ls2=als[:K]
  ls3=als[K:]
  ls2.sort()
  ls3.sort()
  ans=set()
  ans.add(mul*ls3[0]//ls2[-1])
  ans.add(mul*ls3[-1]//ls2[0])
  ans.add(mul*ls3[-1]//ls2[-1])
  ans.add(mul*ls3[0]//ls2[0])
  print(max(ans)%MOD)


### FIXED CODE ###

MOD=10**9+7
N,K=[int(s) for s in input().split()]
ls=[int(s) for s in input().split()]
ans=set()
ls=sorted(ls, key=lambda x: -abs(x))
mul=1
sign=0
zeroflag=0
flag=[0 for _ in range(N)]
for i in range(K):
  flag[i]=1
  if ls[i]<0:
    sign=(sign+1)%2
if sign==1:
  if 0 in ls:
    zeroflag=1
  a=[0,0,0,0]
  b=[0,0,0,0]
  for j in range(K,N):
    if ls[j]>0:
      for k in range(K):
        if ls[K-1-k]<0:
          a[0]=ls[j]
          b[0]=j
          a[1]=ls[K-1-k]
          b[1]=K-1-k
          break
      break
  for j in range(K,N):
    if ls[j]<0:
      for k in range(K):
        if ls[K-1-k]>0:
          a[2]=ls[j]
          b[2]=j
          a[3]=ls[K-1-k]
          b[3]=K-1-k
          break
      break
  if a==[0,0,0,0]:
    flag.reverse()
  elif b[0]==0 and b[1]==0:
    flag[b[2]]=1
    flag[b[3]]=0
  elif b[2]==0 and b[3]==0:
    flag[b[0]]=1
    flag[b[1]]=0
  elif abs(a[0]*a[3])>abs(a[1]*a[2]):
    flag[b[0]]=1
    flag[b[1]]=0
  else:
    flag[b[2]]=1
    flag[b[3]]=0
if sign==1 and a==[0,0,0,0] and zeroflag==1:
  print(0)
else:
  mul=1
  for i in range(N):
    if flag[i]==1:
      mul=mul*ls[i]%MOD
  print(mul)
n,d=map(int,input().split())
in n%(2*d+1)==0:
  print(n//(2*d+1))
else:
  print(n//(2*d+1)+1)


### FIXED CODE ###

n,d=map(int,input().split())
if n%(2*d+1)==0:
  print(n//(2*d+1))
else:
  print(n//(2*d+1)+1)
N = int(input())
X = []
for i in range(N):
	s, p = input()
	X.append([s, -int(p),  i+1])
X.sort()
for i in range(N):
	print(-X[i][1])

### FIXED CODE ###

N = int(input())
X = []
for i in range(N):
	s, p = input().split()
	X.append([s, -int(p),  i+1])
X.sort()
for i in range(N):
	print(X[i][2])
S=list(input())
c=0
while len(S)>1:
    before=len(S)
    l=0
    # 双方向から見ればループ回数は半分になる？
    for i in range(before//2):
    #for i in range(before-1):
        if S[i]+S[i+1]=="01" or S[i]+S[i+1]=="10":
            c+=2
            #S.pop(i)
            #S.pop(i)
            del S[i:i+2]
            #break
            l=1
        if S[-i-1]+S[-i-2]=="10" or S[-i-1]+S[-i-2]=="01":
            c+=2
            if i==0:
                del S[-i-2:]
            else:
                del S[-i-2:-i]
            break
        if l:
          	break
    if before==len(S):
        break
print(c)




### FIXED CODE ###

S=input()
print(2*min(S.count("0"), S.count("1")))
from scipy.sparse.csgraph import dijkstra
from scipy.sparse import csr_matrix

N, M, S, T, *UVAB = map(int, open(0).read().split())
A, B, R, C = [], [], [], []
for u, v, a, b in zip(*[iter(UVAB)] * 4):
    A.append(a)
    B.append(b)
    R.append(u)
    C.append(v)

A = dijkstra(csr_matrix((A, (R, C)), (N + 1, N + 1)), False, S, min_only=True)
B = dijkstra(csr_matrix((B, (R, C)), (N + 1, N + 1)), False, T, min_only=True)

C = (A + B).astype(int)

init = 10 ** 15
ans = []
cur = float("inf")
for c in reversed(C[1:]):
    cur = min(cur, c)
    ans.append(init - cur)

for a in reversed(ans):
    print(a)

### FIXED CODE ###

from heapq import heappush, heappop

INF = float("inf")
def dijkstra(E, r):
    D = [INF] * len(E)
    D[r] = 0

    Q = [(0, r)]
    while Q:
        dist, cur = heappop(Q)
        for nxt, cost in E[cur]:
            cand = dist + cost
            if D[nxt] > cand:
                D[nxt] = cand
                heappush(Q, (cand, nxt))

    return D


N, M, S, T, *UVAB = map(int, open(0).read().split())
A = [[] for _ in range(N + 1)]
B = [[] for _ in range(N + 1)]
for u, v, a, b in zip(*[iter(UVAB)] * 4):
    A[u].append((v, a))
    A[v].append((u, a))
    B[u].append((v, b))
    B[v].append((u, b))

A = dijkstra(A, S)
B = dijkstra(B, T)

init = 10 ** 15

ans = []
cur = INF
for a, b in zip(reversed(A[1:]), reversed(B[1:])):
    cur = min(cur, a + b)
    ans.append(init - cur)

for a in reversed(ans):
    print(a)
import cmath
a,b,h,m=map(int, input().split(" "))

print(abs(a*cmath.exp(j*(h+m/60)*cmath.pi/6)-b*cmath.exp(j*m*2*cmath.pi/60)))

### FIXED CODE ###

import cmath
a,b,h,m=map(int, input().split(" "))

print(abs(a*cmath.exp(1j*(h+m/60)*cmath.pi/6)-b*cmath.exp(1j*m*2*cmath.pi/60)))
a,b,c=[int(input()) for i in range(3)]
if  (a+b)>=c:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

a,b,c=map(int,input().split())
if  (a+b)>=c:
    print("Yes")
else:
    print("No")