Raspberry and Cherry

0

0 votes
easy-medium, Easy, Sorting Records
Problem

Raspberry and Cherry decided to play a game together on this Valentine. There are n levels in the game. Each level has a difficulty d associated with it. Each level also have some enemies e in it. It is allowed to do any random level in the game at a time i.e. you are not bound to solve the level 3 after level 2.

Raspherry(Raspberry+Cherry) can only solve the easiest k levels of the game.
You are supposed to tell the level number, difficulty and the no of enemies in the level that Raspherry can't solve.

Note : Obviously, Raspheery will attempt the levels in order of their difficulty (and not the level numbers).

Input :

First line contain n, the number of levels.
Next n lines contains the difficulty d and no of enemies e separated by space in order of the level numbers.
Next line contain the value of k.

 

Output :
Print the level number, difficulty and the no of enemies of the first level that Raspherry won't be able to solve in a single line separated by space.


Constraints :
n<=106
d,e<=109
k<n

P.S. - If two levels have same difficulty, then Raspherry first solves the question with lower level number.

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

1st level has difficulty 4 and 5 enemies.
Similarly 2nd level has difficulty 3 and 6 enemies and so on

As k=3, therefore Raspherry are able to complete 1st, 2nd and 4th levels with difficulty 4, 3 and 2 respectively.
The first level they encounter which they are not able to solve is level 3 with difficulty 5 and 19 enemies in it.
 

P.S. - Raspherry solves the levels in order of their difficulty.

Editor Image

?