#C14423. Pair Sum Finder

    ID: 44071 Type: Default 1000ms 256MiB

Pair Sum Finder

Pair Sum Finder

Given a list of integers and a target value, your task is to find two numbers in the list such that their sum equals the target value. If such a pair exists, output the two numbers separated by a space in the order they appear in the list; otherwise, output -1.

If there are multiple valid pairs, output any one of them.

Note: The solution must read input from stdin and write the result to stdout.

inputFormat

The input consists of three lines:

  1. The first line contains a single integer n, representing the number of elements in the list.
  2. The second line contains n space-separated integers.
  3. The third line contains a single integer, the target value.

outputFormat

If a pair is found, output the two numbers separated by a space. Otherwise, output -1.

## sample
4
2 7 11 15
9
2 7