using
System;
class
GFG{
class
pair
{
public
int
first, second;
public
pair(
int
first,
int
second)
{
this
.first = first;
this
.second = second;
}
}
static
int
checkIntersection(pair p1,
pair p2,
pair p)
{
int
val;
if
(p1.second == p2.second
&& p1.second == p.second) {
if
(p.first <= Math.Max(p1.first, p2.first)
&& (p.first >= Math.Min(p1.first, p2.first)))
return
1;
}
if
(p1.first == p2.first
&& p1.first == p.first) {
if
(p.second <= Math.Max(p1.second, p2.second)
&& (p.second >= Math.Min(p1.second, p2.second)))
return
1;
}
else
{
val = (p.second - p1.second)
* (p2.first - p1.first)
- (p.first - p1.first)
* (p2.second - p1.second);
if
(val == 0)
if
((p.first <= Math.Max(p1.first, p2.first)
&& (p.first >= Math.Min(p1.first, p2.first)))
&& (p.second <= Math.Max(p1.second, p2.second)
&& (p.second >= Math.Min(p1.second, p2.second))))
return
1;
}
return
0;
}
static
void
towerOfSight(pair a,
pair b,
pair c,
pair d)
{
int
flag = 0;
if
(checkIntersection(a, c, b) == 1)
flag = 1;
else
if
(checkIntersection(a, c, d) == 1)
flag = 1;
else
if
(checkIntersection(b, d, a) == 1)
flag = 1;
else
if
(checkIntersection(b, d, c) == 1)
flag = 1;
Console.Write(flag==1?
"Yes\n"
:
"No\n"
);
}
public
static
void
Main(String[] args)
{
pair a =
new
pair( 0, 0 );
pair b =
new
pair( 0, -2 );
pair c =
new
pair( 2, 0 );
pair d =
new
pair( 0, 2 );
towerOfSight(a, b, c, d);
}
}