An axis parallel N-orthotope is the set of N dimensional points written in this form.
[s1,e1]×[s2,e2]×⋯×[sN,eN](si<ei)
That is, it collects every point (x1,x2,…,xN) whose coordinate xi satisfies si≤xi≤ei.
Generalize a little and allow si≤ei in the product
[s1,e1]×[s2,e2]×⋯×[sK,eK](si≤ei)
If exactly N indices satisfy si<ei, this set of points is an axis parallel N-orthotope. The words 'axis parallel' are dropped from here on, but every orthotope below is still axis parallel.
Two N-orthotopes are given for some N. If some points belong to both regions at once, those points form an M-orthotope. Write a program that computes M. For 2-orthotopes there are the four cases below.

The first line has a natural number N.
The second line has s1,e1,s2,e2,…,sN,eN of the first region, separated by spaces.
The third line has s1,e1,s2,e2,…,sN,eN of the second region, separated by spaces.
Every given number is an integer with absolute value at most 11, and si<ei holds for each i.
1≤N≤11.
On the first line print M if the common region of the two regions is an M-orthotope. If there is no common region, print -1.