#K59732. Filter Auction Items
Filter Auction Items
Filter Auction Items
You are given a list of auction items represented by pairs of integers \(p_i\) and \(i_i\). Here, \(p_i\) denotes the starting bid and \(i_i\) denotes the bid increment for the \(i\text{-th}\) item. An auction item is considered valid if:
- Both \(p_i\) and \(i_i\) are even numbers (i.e. \(p_i \bmod 2 = 0\) and \(i_i \bmod 2 = 0\)).
- For every item with \(i > 0\), the starting bid \(p_i\) must be strictly greater than the starting bid of the previous item \(p_{i-1}\) (i.e. \(p_i > p_{i-1}\)).
Your task is to output all valid auction items in the order they appear in the list. If no items satisfy the criteria, do not print anything.
inputFormat
The input is given via standard input and has the following format:
The first line contains a single integer (N) ((1 \le N \le 10^5)), the number of auction items.
Each of the following (N) lines contains two space-separated integers (p_i) and (i_i) representing the starting bid and bid increment respectively.
outputFormat
For each valid auction item, output a line with two integers (p_i) and (i_i) separated by a space. The items must be output in the same order as they appear in the input. If there are no valid items, output nothing.## sample
4
2 4
6 2
3 6
8 8
2 4
6 2
8 8
</p>