1. Abridged Problem Statement
-----------------------------
You are given all pairwise XORs of an unknown set A of size n: B contains M = n·(n–1)/2 numbers, each equal to Ai⊕Aj for all 1≤i<j≤n, in arbitrary order. Moreover, A has no nontrivial subset (size≥2) whose XOR is 0 (equivalently, its elements are linearly independent over GF(2)). Recover any valid A (order doesn’t matter).

2. Detailed Editorial
---------------------
Key observations:
- XOR is addition in the GF(2) vector space of 31-bit integers.
- “No subset XORs to zero” means the elements of A form a linearly independent set (a basis) in that vector space.
- The multiset B of all pairwise XORs then consists exactly of all Xi⊕Xj for basis elements Xi, Xj.

Our goal is to find a basis {X1,…,Xn} such that the set of pairwise XORs matches B. Since a basis always can be “shifted” by XORing every element with a fixed vector without changing pairwise XORs, we may WLOG include 0 in our reconstructed set: if we recover {0, X2⊕X1, X3⊕X1,…}, then XORing the entire set with X1 yields a valid solution containing X1.

Algorithm outline:
1. Read m and array B of size m. Compute n from m = n(n–1)/2 via n = (1 + √(1 + 8m)) / 2.
2. Build a set `present` marking all values in B for O(1) lookup.
3. We grow our answer vector `ans` starting from {0}. Maintain:
   - `span` = all XORs of subsets of ans found so far (its linear span over GF(2), initially {0}).
   - `in_span` = a set of those reachable XORs (initially {0}).
4. Iterate through each b in B (in any order). If b is already in `in_span`, skip it (accepting it would create a zero-XOR subset). Otherwise, test whether adding b as a new basis element is valid: check that for every existing basis element a in ans, the xor b⊕a exists in `present` (i.e., that the new pairwise XORs b introduces are all consistent with B).
5. If valid, incorporate b: for each existing subset‐XOR s in `span`, compute t = b⊕s and add t to `in_span` and `span`. Then append b to ans as a new basis vector.
6. After the full scan, ans = {0, X2, X3, …, Xn}. Print ans; it’s a valid set A′. If desired, XOR each by some a to shift off the 0, but that’s optional because 0 is allowed.

Complexity:
- n≤15 (because m≤100), B size m=O(n²).
- For each candidate b we test O(n) existing basis elements, each lookup O(log n) in a set.
- Updating span costs O(2^k) where k is current basis size ≤n, so total ≈O(2^n·n) ≤ ~500k.
Under m=100, this easily runs within time/memory limits.

3. C++ Solution
```cpp
#include <bits/stdc++.h>

using namespace std;

template<typename T1, typename T2>
ostream& operator<<(ostream& out, const pair<T1, T2>& x) {
    return out << x.first << ' ' << x.second;
}

template<typename T1, typename T2>
istream& operator>>(istream& in, pair<T1, T2>& x) {
    return in >> x.first >> x.second;
}

template<typename T>
istream& operator>>(istream& in, vector<T>& a) {
    for(auto& x: a) {
        in >> x;
    }
    return in;
};

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& a) {
    for(auto x: a) {
        out << x << ' ';
    }
    return out;
};

int m, n;
vector<int> b;

void read() {
    cin >> m;
    b.resize(m);
    cin >> b;
    n = (1 + (int)sqrt(1 + 8 * m)) / 2;
}

void solve() {
    // B holds all M = n(n-1)/2 pairwise XORs of the unknown set A. Since any
    // pairwise XOR is unchanged by XOR-ing every element of A with the same
    // constant, we may fix the first reconstructed element to 0.
    //
    // - present = the multiset of values that appear in B (any reconstructed
    //   pairwise XOR must be one of these).
    //
    // - ans = the elements we have committed to (starting with 0), and span =
    //   the set of XORs of all subsets of ans (its linear span over GF(2)),
    //   used to detect when a new value is XOR-dependent on chosen ones.
    //
    // We scan the B values in order. We accept a candidate value v only when
    // it is not already in span (otherwise it would create a zero-XOR subset)
    // and v ^ a is a value present in B for every a already in ans, i.e. the
    // new pairwise XORs it introduces are all consistent with B. On accepting
    // v we extend span by XOR-ing v into every current span element and append
    // v to ans.

    set<int> present;
    for(int x: b) {
        present.insert(x);
    }

    vector<int> ans = {0}, span = {0};
    set<int> in_span = {0};

    for(int i = 0; i < m; i++) {
        if(in_span.count(b[i])) {
            continue;
        }

        bool ok = true;
        for(int a: ans) {
            if(!present.count(b[i] ^ a)) {
                ok = false;
            }
        }

        if(ok) {
            int sz = span.size();
            for(int x = 0; x < sz; x++) {
                int val = b[i] ^ span[x];
                span.push_back(val);
                in_span.insert(val);
            }

            ans.push_back(b[i]);
        }
    }

    cout << ans << '\n';
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int T = 1;
    // cin >> T;
    for(int test = 1; test <= T; test++) {
        read();
        // cout << "Case #" << test << ": ";
        solve();
    }

    return 0;
}
```

4. Python Solution
```python
import math
import sys

def main():
    data = sys.stdin.read().split()
    m = int(data[0])
    Bs = list(map(int, data[1:]))

    # Recover n from m = n*(n-1)/2
    n = int((1 + math.isqrt(1 + 8*m)) // 2)

    # present: set of all given pairwise XORs for fast lookup
    present = set(Bs)

    # ans: our basis, start with 0
    ans = [0]
    # span: all XORs of subsets of ans
    span = [0]
    # in_span: set of reachable XORs
    in_span = {0}

    # Try each b in Bs as candidate basis element
    for b in Bs:
        if b in in_span:
            # Already spanned by current basis
            continue

        # Check that XOR with every existing basis element is in B
        valid = True
        for a in ans:
            if (b ^ a) not in present:
                valid = False
                break
        if not valid:
            continue

        # Accept b
        # Update span and in_span by XORing b with all existing subset XORs
        old_span = list(span)
        for s in old_span:
            t = b ^ s
            if t not in in_span:
                in_span.add(t)
                span.append(t)

        ans.append(b)

    # Print the reconstructed set (contains 0)
    print(" ".join(map(str, ans)))

if __name__ == "__main__":
    main()
```

5. Compressed Editorial
------------------------
- A’s elements are linearly independent vectors over GF(2). B lists all pairwise XORs Ai⊕Aj.
- We can WLOG include 0 in our reconstruction (shifting by any A-element preserves B).
- Algorithm: maintain a basis `ans` (starting with 0), a set `present` of all B-values, and track all subset XORs `span` plus a set `in_span` of those XORs.
- For each candidate b in B not yet in `in_span`, if for every existing basis a we have (b⊕a)∈present, accept b: update span/in_span by XORing b with all existing subset XORs, and append b to ans.
- Output ans.
