# Two Numbers with Odd Frequencies
## Problem Statement
You are given an array $a$ containing $n$ integers. It is guaranteed that exactly two distinct numbers in the array appear an odd number of times, while all other numbers appear an even number of times. Your task is to identify and output these two numbers.
## Input Format
- First line: A single integer $n$ ($1 \le n \le 10^5$) - The number of elements in the array.
- Second line: $n$ integers $a_1, a_2, \dots, a_n$ ($-10^9 \le a_i \le 10^9$) - The elements of the array.
## Output Format
Output the two distinct numbers that appear an odd number of times, separated by a single space. The numbers must be printed in ascending order.
## Sample Test Cases
### Sample Input 1
```
8
4 1 2 1 2 3 4 5
```
### Sample Output 1
```
3 5
```
### Sample Input 2
```
6
-10 20 -10 30 20 40
```
### Sample Output 2
```
30 40
```
## Constraints
- $1 \le n \le 10^5$
- $-10^9 \le a_i \le 10^9$
- It is guaranteed that exactly two distinct numbers appear an odd number of times.
- Time limit: 1 second
- Memory limit: 256 MB
## Explanation
### Sample 1
Given array: $[4, 1, 2, 1, 2, 3, 4, 5]$.
- The number 1 appears 2 times (even frequency).
- The number 2 appears 2 times (even frequency).
- The number 3 appears 1 time (odd frequency).
- The number 4 appears 2 times (even frequency).
- The number 5 appears 1 time (odd frequency).
The numbers appearing an odd number of times are 3 and 5. When printed in ascending order, the output is `3 5`.
### Sample 2
Given array: $[-10, 20, -10, 30, 20, 40]$.
- The number -10 appears 2 times (even frequency).
- The number 20 appears 2 times (even frequency).
- The number 30 appears 1 time (odd frequency).
- The number 40 appears 1 time (odd frequency).
The numbers appearing an odd number of times are 30 and 40. When printed in ascending order, the output is `30 40`.
Loading problem statement...