PivotOJ

Moderate Pace

시간 제한: 2000ms메모리 제한: 512MB출처: UKIEPC 2020BOJ 20341

문제

An ultra-marathon is a race that takes place over an uncomfortably long distance and time, typically lasting for five hours or more. You are part of a group of three ultra-marathon runners looking to place in this year's Great South-to-North run from Plymouth to Aberdeen.

You have a set number of days until the next race to train. You will all train together, as training alone can be dangerous. As everyone has their own schedule in mind for how many kilometres to run per day, this will not be easy, you will have to compromise.

The fairest option is to look at each day individually, examine the three options for how far to run, and to take the median one. That is to say, the option taken for each day should be one that is not be greater or lesser than both of the other possibilities at the same time.

입력

  • A line with the integer nn (1n10001\leq n\leq1000), the number of days of training.
  • A line with nn integers k1,,nk_{1,\ldots,n} (0k1060\leq k \leq 10^6), your ideal daily distances.
  • A line with nn integers a1,,na_{1,\ldots,n} (0a1060\leq a \leq 10^6), your first colleague's ideal daily distances.
  • A line with nn integers b1,,nb_{1,\ldots,n} (0b1060\leq b \leq 10^6), your second colleague's ideal daily distances.

출력

Output a plan for the nn days as nn integers, where the distance for every day corresponds to the median of choices for that day.

예제

예제 1

입력
4
1 2 3 4
4 3 2 1
2 2 2 2
출력
2 2 2 2

예제 2

입력
6
3 1 4 1 5 9
2 7 1 8 2 8
1 6 1 8 0 3
출력
2 6 1 8 2 8
코드를 제출하려면 로그인하세요.