We are given: "Given N different natural numbers a_i. I decided to make a pair by choosing a different natural number from the given natural numbers. Output one pair that can be created with a value difference that is a multiple of N-1. It should be noted that such a pair always exists."
Interpretation: We have N distinct natural numbers (I assume positive integers, but natural numbers could include 0? Usually natural numbers start from 0 or 1, but we'll treat as nonnegative? The sample: N=5, numbers 1,2,4,7,10. N-1=4. Pairs with difference multiple of 4: 2 and 10 difference 8 -> multiple of 4. Also 1 and 5? not present. 1 and 9? not. So output 2 10.
So we need to find two distinct numbers among the given N such that their difference is divisible by N-1. Always exists.
We need to output any such pair.
Constraints? Not given, but presumably N up to maybe 10^5 or something. The numbers are distinct natural numbers, maybe up to large values. But we just need to find a pair.
How to guarantee existence? By pigeonhole principle? Considering residues modulo (N-1). Since there are N numbers and only N-1 residues modulo (N-1) (0,1,...,N-2), by pigeonhole principle there must be at least two numbers that are congruent modulo N-1. Then their difference is divisible by N-1. Indeed, that's the standard argument: N numbers, modulo N-1 residues, there are N-1 possible residues (assuming mod is N-1). So at least two numbers share same residue. Their difference is multiple of N-1. Since numbers are distinct, difference >0.
Thus algorithm: compute each a_i mod (N-1). Find two indices i != j with same residue. Output those two numbers (order doesn't matter, maybe ascending? Sample output: "2 10" seems just two numbers separated by space; could be any order).
Edge cases: N=1? But then N-1=0, multiple of 0? That's undefined. But problem likely ensures N >= 2. Since we need a pair from given numbers, N must be at least 2.
Also note: natural numbers might be large, but modulo operation is fine.
Thus solution is straightforward.
We should read N, then N numbers. Compute N-1 = mod = N-1. Then compute remainder for each number: r = a_i % mod. Use a hashmap/dictionary mapping remainder to index (or to value). When we encounter a remainder already in map, output both numbers and exit.
Time O(N), space O(N) or O(N-1) for storing remainders.
Implementation details: Input format: first line N, second line N numbers? Or may be multiple lines? Usually one line with N numbers. We'll read accordingly.
Edge Cases: mod = N-1. If mod = 0? That would happen if N=1, not allowed. So fine.
But careful: if N-1 = 1, then all numbers are congruent mod 1 (0), so any pair works. But our algorithm still works: all remainders 0, first number stored, second encountered gives pair.
Note: The numbers are natural numbers (non-negative integers). So remainder mod 0? Not. So N>=2.
Thus we can implement.
We should output two numbers: e.g., print(a_i, a_j) or maybe in ascending order? Not specified; any order is acceptable.
Let's test with sample: N=5, mod=4. Numbers:1%4=1, 2%4=2, 4%4=0, 7%4=3, 10%4=2. At 10 we find remainder 2 already mapped to 2, so output 2 and 10.
Works.
Thus solution.
Now produce final answer with code (maybe in Python) and explanation.
We need to respond with a solution description and code. The problem statement is in Vietnamese? Actually it's given in English: "Given N different natural numbers ..." but the sample input and output are typical. I'll answer in English.
We must provide final answer: solution explanation and code.
Thus final. We can solve the problem using the pigeonhole principle. Since there are N numbers but only N-1 possible residues modulo N-1, at least two numbers have the same remainder when divided by N-1. Their difference is then a multiple of N-1. We simply compute the remainder of each number modulo N-1 and stop as soon as we find a remainder that has already been seen. The two numbers corresponding to that remainder are a valid pair.
Time complexity: O(N)
Space complexity: O(N) (to store remainders, or O(N-1) at worst)
import sys
def main():
data = sys.stdin.read().strip().split()
if not data:
return
it = iter(data)
n = int(next(it))
mod = n - 1 # N >= 2, so mod > 0
# Dictionary: remainder -> first value with that remainder
seen = {}
for _ in range(n):
x = int(next(it))
r = x % mod
if r in seen:
# Found a pair
print(seen[r], x)
return
seen[r] = x
if __name__ == "__main__":
main()