//デバッグ用オプション:-fsanitize=undefined,address //コンパイラ最適化 #pragma GCC optimize("Ofast") //インクルードなど #include //#include using namespace std; //using namespace atcoder; typedef long long ll; using vint = vector; using vll = vector; using vbool = vector; using vs = vector; using P = pair; using vp = vector

; template using arr = vector>; //マクロ #define REP(i, n) for (ll i = 0; i < ll(n); i++) #define REPD(i, n) for (ll i = n - 1; i >= 0; i--) #define FOR(i, a, b) for (ll i = a; i < ll(b); i++) #define FORD(i, a, b) for (ll i = a; i >= ll(b); i--) #define FORA(i, I) for (const auto &i : I) #define ALL(x) x.begin(), x.end() #define SIZE(x) ll(x.size()) #define INF 9223372036854775807 template bool chmax(T &a, const T &b) { if (a < b) { a = b; // aをbで更新 return true; } return false; } template bool chmin(T &a, const T &b) { if (a > b) { a = b; // aをbで更新 return true; } return false; } template void pl(T x) { cout << x << " "; } template void pr(T x) { cout << x << endl; } template void prvec(const vector &a) { REP(i, a.size() - 1) { cout << a[i] << " "; } pr(a[a.size() - 1]); } template void prarr(const arr &a) { REP(i, a.size()) if (a[i].empty()) pr(""); else prvec(a[i]); } template pair operator+(const pair &l, const pair &r) { return {l.first + r.first, l.second + r.second}; } template pair operator-(const pair &l, const pair &r) { return {l.first - r.first, l.second - r.second}; } template pair operator*(const pair &l, const T &r) { return {l.first * r, l.second * r}; } template pair operator/(const pair &l, const T &r) { return {l.first / r, l.second / r}; } template istream &operator>>(istream &is, vector &vec) { for (auto &v : vec) is >> v; return is; } template ostream &operator<<(ostream &os, const vector &vec) { os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; } template ostream &operator<<(ostream &os, const deque &vec) { os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; } template ostream &operator<<(ostream &os, const set &vec) { os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; } template ostream &operator<<(ostream &os, const unordered_set &vec) { os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; } template ostream &operator<<(ostream &os, const multiset &vec) { os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; } template ostream &operator<<(ostream &os, const unordered_multiset &vec) { os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; } template istream &operator>>(istream &is, pair &pa) { is >> pa.first >> pa.second; return is; } template ostream &operator<<(ostream &os, const pair &pa) { os << "(" << pa.first << "," << pa.second << ")"; return os; } template istream &operator>>(istream &is, tuple &theTuple) { apply([&is](Ts &...tupleArgs) { ((is >> tupleArgs), ...); }, theTuple); return is; } template ostream &operator<<(ostream &os, const tuple &theTuple) { apply([&os](const Ts &...tupleArgs) { os << '('; size_t n(0); ((os << tupleArgs << (++n < sizeof...(Ts) ? "," : "")), ...); os << ')'; }, theTuple); return os; } template ostream &operator<<(ostream &os, const map &mp) { os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; } template ostream &operator<<(ostream &os, const unordered_map &mp) { os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; } // const int intinf = numeric_limits::max(); // const ll INF = numeric_limits::max(); // const P udlr[4] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}}; // // struct Constants { ll N; Constants() { N = 3; } } C; struct Args { vll a, b; Args() : a(C.N), b(C.N) { ios::sync_with_stdio(false); cin.tie(nullptr); cin >> a >> b; } } args; struct Solver { bool ans; Solver() : ans(false) { } bool ok(const vll &v) { REP(i, C.N - 1) { FOR(j, i + 1, C.N) { if (v.at(i) == v.at(j)) { return false; } } } if (v.at(0) < v.at(1) && v.at(1) > v.at(2)) { return true; } if (v.at(0) > v.at(1) && v.at(1) < v.at(2)) { return true; } return false; } // void solve() { if (ok(args.a) && ok(args.b)) { ans = true; return; } REP(i, C.N) { REP(j, C.N) { vll a(args.a); vll b(args.b); swap(a.at(i), b.at(j)); if (ok(a) && ok(b)) { ans = true; return; } } } } // void output() { pr(ans ? "Yes" : "No"); } } s; int main() { s.solve(); s.output(); return 0; }