static bool pairContains(Pair p, O o) { ret p != null && (p.a == o || p.b == o); }