## Goal
`scene.json` contains `N` pairs of rigid motions `(A_i, B_i)`, each a 4×4 homogeneous
matrix. They satisfy, for one **unknown constant** rigid transform `X`:

```
A_i · X = X · B_i     for every i
```

Recover `X` and write it to `result.json`. The data is **noise-free**, so `X` is exact
and unique.

## Conventions
- 4×4 matrices are **row-major** rigid transforms: upper-left 3×3 is an orthonormal
  rotation (det = +1), last column is translation (mm), bottom row is `[0,0,0,1]`.
- Your `X` must be a valid rigid transform in the same form.

## Method (any correct approach is accepted)
A standard closed form (Park & Martin, or Tsai–Lenz):
1. For each pair, take `α_i = log(R_A_i)`, `β_i = log(R_B_i)` (rotation-vector via the
   SO(3) logarithm). Build `M = Σ β_i α_iᵀ`; then `R_X = (Mᵀ M)^(-1/2) Mᵀ`.
2. Solve the stacked linear system `(R_A_i − I) t_X = R_X t_B_i − t_A_i` for `t_X` in a
   least-squares sense.

You may use any method (dual quaternions, etc.) as long as the result satisfies the
constraint on all pairs.

## Input: `scene.json`
```
{ "pairs": [ { "A": [[4x4]], "B": [[4x4]] }, ... ] }
```

## Output: `result.json`
```
{
  "X": [[4x4]],
  "max_residual": <float>   // max over i of the Frobenius norm ||A_i X - X B_i||
}
```
Report `X` as a row-major 4×4 and `max_residual` as the largest residual your `X`
achieves across all pairs. Python 3.11 + NumPy only. No network access.
