We fully characterize quasiconvex hulls for three arbitrary solenoidal ( divergence free) wells in dimension three. With this aim we establish weak lower semicontinuity of certain functionals with integrands restricted to generic two-dimensional planes and convex in ( up to three) rank-2 directions within the planes. Within the framework of the theory of compensated compactness, the latter represents an example when the differential constraints fail the constant rank condition but nevertheless the so-called Lambda-convexity still implies lower semicontinuity and A-quasiconvexity ( which essentially means that rank-2 convexity implies S-quasiconvexity-that is quasiconvexity in the sense of the divergence-free differential constraints-on the planes). The proof employs a version of Muller's estimates of Haar wavelet projections in terms of the Riesz transform. The above semicontinuity result is then applied to the three solenoidal wells problem via analogs of Sverak's "nontrivial" quasiconvex functions and connectedness properties of the rank-2 envelopes. As another application of the semicontinuity result, we obtain a "geometric" result of a more general nature: characterization of certain extremal three-point H-measures for three-phase mixtures ( of three characteristic functions) in dimension three. We also discuss the applicability of the results to problems with other differential constrains, in particular to three linear elastic wells, and further generalizations.