# The Rescue Pair

THE GREAT DUCK MIGRATION! · challenge 42 · hard

> Admiral Aqua holds up two rescue harnesses beside the migration map. "Two places, Duckbert. Four disciplines. Your finest swimmers won't help much if neither can clear the ridge! I need a pair who cover each other's weaknesses. In each sport, the stronger duck will take the lead. Judge the pair by the weakest of those four lead scores, then find our strongest rescue team. Add their identification codes to register the pair!"

## Task

Return the sum of the two SSNs in the highest-rated rescue pair. A pair consists of two different ducks. Use each duck's all-time best score in each of the four sports: swimming, running, diving, and flying_speed. For each sport, the pair's score is the higher of the two ducks' best scores; the pair's overall rating is the lowest of its four sport scores. Choose the pair with the highest overall rating. On a tie, choose the pair with the smaller sum of the two SSNs. You will be working with the `duck_athletes` and `performance_records` tables.

## Tables

### `performance_records` (800 rows)

| column | type |
| --- | --- |
| duck_id | BIGINT |
| sport | VARCHAR |
| score | DOUBLE |
| competition_date | DATE |

### `duck_athletes` (50 rows)

| column | type |
| --- | --- |
| id | BIGINT |
| ssn | BIGINT |
| name | VARCHAR |
| age | BIGINT |
| hometown | VARCHAR |

## Data

The tables live in a DuckDB database: https://dbquacks.com/data/databases/athletic_champions.duckdb

To query it outside the browser, attach it read-only:

```sql
ATTACH 'https://dbquacks.com/data/databases/athletic_champions.duckdb' AS db (READ_ONLY);
USE db;
```

Play it in the browser: https://dbquacks.com/challenges/athletic/42

## Answer

The expected answer is not published. Submit on the page to have it checked.
