In this task, we consider arrays of positive integers such as this:
3 18 321 17 4 4 51 1 293 17
The input comprises a pair of such arrays both of arbitrary, possibly distinct, positive length. Determine if a total ordering ≤X ⊂ N × N, where N is the set of positive integers, exists such that both input arrays are in order with respect to ≤X. Notice that (A ≤X B ∧ B ≤X A) ↔ A = B must hold, that is, two numbers are considered equal under ≤X if and only if they are the same number.
For example, if the input was the pair of arrays
7 2 1 1 4 12 3 9 8 7 2 5 1
then you are supposed to figure out if a total ordering ≤X exists such that
7 ≤X 2 ≤X 1 ≤X 1 ≤X 4 ≤X 12 ≤X 3
9 ≤X 8 ≤X 7 ≤X 2 ≤X 5 ≤X 1.
Your submission may be a subroutine or program that receives two arrays (as specified above) of input in an implementation-defined way, computes whether a total ordering ≤X satisfying the demands mentioned above exists and returns one value representing “yes” or a different value representing “no.” The choice of these values is arbitrary, please document them.
You may assume that the input arrays contain no more than 215 - 1 elements each and that each of their elements is in the range from 1 to 215 - 1 inclusive. You may require each arrays to be terminated by a constant sentinel outside of the aforementioned range such as 0. Please specify what sentinel is needed. You may require the lengths of the arrays as additional input if the length cannot be inferred from the arrays themselves (e. g. in languages like C). In addition to the prohibition of standard loopholes, you are not allowed to use topological sorting routines.
This challenge is code golf. The submission with the least amount of characters wins.