Problem: After the war, the supersonic rocket became the most common public transportation.

Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power sources. A power source can be described as a point (x_i, y_i) on a 2-D plane. All points in each engine are different.

You can manipulate each engine separately. There are two operations that you can do with each engine. You can do each operation as many times as you want.

  1. For every power source as a whole in that engine: (x_i, y_i) becomes (x_i+a, y_i+b), a and b can be any real numbers. In other words, all power sources will be shifted.
  2. For every power source as a whole in that engine: (x_i, y_i) becomes (x_i cos θ - y_i sin θ, x_i sin θ + y_i cos θ), θ can be any real number. In other words, all power sources will be rotated.



The engines work as follows: after the two engines are powered, their power sources are being combined (here power sources of different engines may coincide). If two power sources A(x_a, y_a) and B(x_b, y_b) exist, then for all real number k that 0 < k < 1, a new power source will be created C_k(kx_a+(1-k)x_b,ky_a+(1-k)y_b). Then, this procedure will be repeated again with all new and old power sources. After that, the "power field" from all power sources will be generated (can be considered as an infinite set of all power sources occurred).

A supersonic rocket is "safe" if and only if after you manipulate the engines, destroying any power source and then power the engine, the power field generated won't be changed (comparing to the situation where no power source erased). Two power fields are considered the same if and only if any power source in one field belongs to the other one as well.

Given a supersonic rocket, check whether it is safe or not.

Input

The first line contains two integers n, m (3 ≤ n, m ≤ 10^5) — the number of power sources in each engine.

Each of the next n lines contains two integers x_i and y_i (0≤ x_i, y_i≤ 10^8) — the coordinates of the i-th power source in the first engine.

Each of the next m lines contains two integers x_i and y_i (0≤ x_i, y_i≤ 10^8) — the coordinates of the i-th power source in the second engine.

It is guaranteed that there are no two or more power sources that are located in the same point in each engine.

Output

Print "YES" if the supersonic rocket is safe, otherwise "NO".

You can print each letter in an arbitrary case (upper or lower).

Examples

Input

3 4
0 0
0 2
2 0
0 2
2 2
2 0
1 1


Output

YES


Input

3 4
0 0
0 2
2 0
0 2
2 2
2 0
0 0


Output

NO

Note

The first sample:

<image> Those near pairs of blue and orange points actually coincide.

First, manipulate the first engine: use the second operation with θ = π (to rotate all power sources 180 degrees).

The power sources in the first engine become (0, 0), (0, -2), and (-2, 0).

<image>

Second, manipulate the second engine: use the first operation with a = b = -2.

The power sources in the second engine become (-2, 0), (0, 0), (0, -2), and (-1, -1).

<image>

You can examine that destroying any point, the power field formed by the two engines are always the solid triangle (0, 0), (-2, 0), (0, -2).

In the second sample, no matter how you manipulate the engines, there always exists a power source in the second engine that power field will shrink if you destroy it. 

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
const double eps = 1e-8;
const double pi = acos(-1.0);
const long long INF = 0x3f3f3f3f3f3f3f3f;
int dcmp(double x) {
  if (fabs(x) < eps) return 0;
  return (x > 0 ? 1 : -1);
}
inline double sqr(double x) { return x * x; }
struct Point {
  long long x, y;
  Point() { x = 0, y = 0; }
  Point(long long _x, long long _y) : x(_x), y(_y) {}
  void input() { scanf("%lld%lld", &x, &y); }
  void output() { printf("%lld %lld\n", x, y); }
  friend istream &operator>>(istream &os, Point &b) {
    os >> b.x >> b.y;
    return os;
  }
  friend ostream &operator<<(ostream &os, Point &b) {
    os << b.x << ' ' << b.y;
    return os;
  }
  bool operator==(const Point &b) const {
    return (dcmp(x - b.x) == 0 && dcmp(y - b.y) == 0);
  }
  bool operator!=(const Point &b) const {
    return !((dcmp(x - b.x) == 0 && dcmp(y - b.y) == 0));
  }
  bool operator<(const Point &b) const {
    return (dcmp(x - b.x) == 0 ? dcmp(y - b.y) < 0 : x < b.x);
  }
  long long operator^(const Point &b) const { return x * b.y - y * b.x; }
  long long operator*(const Point &b) const { return x * b.x + y * b.y; }
  Point operator+(const Point &b) const { return Point(x + b.x, y + b.y); }
  Point operator-(const Point &b) const { return Point(x - b.x, y - b.y); }
  Point operator*(double a) { return Point(x * a, y * a); }
  Point operator/(double a) { return Point(x / a, y / a); }
  long long len2() { return sqr(x) + sqr(y); }
  long long len() { return sqrt(len2()); }
  double polar() { return atan2(y, x); }
  Point change_len(double r) {
    double l = len();
    if (dcmp(l) == 0) return *this;
    return Point(x * r / l, y * r / l);
  }
  Point rotate_left() { return Point(-y, x); }
  Point rotate_right() { return Point(y, -x); }
  Point rotate(Point p, double ang) {
    Point v = (*this) - p;
    double c = cos(ang), s = sin(ang);
    return Point(p.x + v.x * c - v.y * s, p.y + v.x * s + v.y * c);
  }
  Point normal() { return Point(-y / len(), x / len()); }
};
double cross(Point a, Point b) { return a.x * b.y - a.y * b.x; }
double dot(Point a, Point b) { return a.x * b.x + a.y * b.y; }
double dis(Point a, Point b) {
  Point p = b - a;
  return p.len();
}
double dis2(Point a, Point b) {
  Point p = b - a;
  return p.len2();
}
double rad_degree(double rad) { return rad / pi * 180; }
double degree_rad(double deg) { return deg / 180 * pi; }
double rad(Point a, Point b) {
  return fabs(atan2(fabs(cross(a, b)), dot(a, b)));
}
bool is_parallel(Point a, Point b) {
  double p = rad(a, b);
  return dcmp(p) == 0 || dcmp(p - pi) == 0;
}
struct Line {
  Point s, e;
  Line() {}
  Line(Point _s, Point _e) : s(_s), e(_e) {}
  Line(Point p, double ang) {
    s = p;
    if (dcmp(ang - pi / 2) == 0) {
      e = s + Point(0, 1);
    } else {
      e = s + Point(1, tan(ang));
    }
  }
  Line(double a, double b, double c) {
    if (dcmp(a) == 0) {
      s = Point(0, -c / b);
      e = Point(1, -c / b);
    } else if (dcmp(b) == 0) {
      s = Point(-c / a, 0);
      e = Point(-c / a, 1);
    } else {
      s = Point(0, -c / b);
      e = Point(1, (-c - a) / b);
    }
  }
  void input() {
    s.input();
    e.input();
  }
  void adjust() {
    if (e < s) swap(e, s);
  }
  double length() { return dis(s, e); }
  double polar() { return atan2(e.y - s.y, e.x - s.x); }
  double angle() {
    double k = atan2(e.y - s.y, e.x - s.x);
    if (dcmp(k) < 0) k += pi;
    if (dcmp(k - pi) == 0) k -= pi;
    return k;
  }
  Point operator&(const Line &b) const {
    Point res = s;
    double t = ((s - b.s) ^ (b.s - b.e)) / ((s - e) ^ (b.s - b.e));
    res.x += (e.x - s.x) * t;
    res.y += (e.y - s.y) * t;
    return res;
  }
};
int relation(Point p, Line l) {
  int c = dcmp(cross(p - l.s, l.e - l.s));
  if (c < 0)
    return 1;
  else if (c > 0)
    return 2;
  else
    return 3;
}
bool point_on_seg(Point p, Line l) {
  return dcmp(cross(p - l.s, l.e - l.s)) == 0 &&
         dcmp(dot(p - l.s, p - l.e) <= 0);
}
bool is_parallel(Line a, Line b) { return is_parallel(a.e - a.s, b.e - b.s); }
int seg_cross_seg(Line a, Line v) {
  int d1 = dcmp(cross(a.e - a.s, v.s - a.s));
  int d2 = dcmp(cross(a.e - a.s, v.e - a.s));
  int d3 = dcmp(cross(v.e - v.s, a.s - v.s));
  int d4 = dcmp(cross(v.e - v.s, a.e - v.s));
  if ((d1 ^ d2) == -2 && (d3 ^ d4) == -2) return 2;
  return (d1 == 0 && dcmp(dot(v.s - a.s, v.s - a.e)) <= 0) ||
         (d2 == 0 && dcmp(dot(v.e - a.s, v.e - a.e)) <= 0) ||
         (d3 == 0 && dcmp(dot(a.s - v.s, a.s - v.e)) <= 0) ||
         (d4 == 0 && dcmp(dot(a.e - v.s, a.e - v.e)) <= 0);
}
int line_cross_seg(Line a, Line v) {
  int d1 = dcmp(cross(a.e - a.s, v.s - a.s));
  int d2 = dcmp(cross(a.e - a.s, v.e - a.s));
  if ((d1 ^ d2) == -2) return 2;
  return (d1 == 0 || d2 == 0);
}
int line_cross_line(Line a, Line v) {
  if (is_parallel(a, v)) return relation(a.e, v) == 3;
  return 2;
}
Point line_intersection(Line a, Line v) {
  double a1 = cross(v.e - v.s, a.s - v.s);
  double a2 = cross(v.e - v.s, a.e - v.s);
  return Point((a.s.x * a2 - a.e.x * a1) / (a2 - a1),
               (a.s.y * a2 - a.e.y * a1) / (a2 - a1));
}
Point line_intersection(Line line, double a, double b, double c) {
  double u = fabs(a * line.s.x + b * line.s.y + c);
  double v = fabs(a * line.e.x + b * line.e.y + c);
  return Point((line.s.x * v + line.e.x * u) / (u + v),
               (line.s.y * v + line.e.y * u) / (u + v));
}
double point_to_line(Point p, Line a) {
  return fabs(cross(p - a.s, a.e - a.s) / a.length());
}
double point_to_seg(Point p, Line a) {
  if (dcmp(dot(p - a.s, a.e - a.s)) < 0 || dcmp(dot(p - a.e, a.s - a.e)) < 0)
    return min(dis(p, a.e), dis(p, a.s));
  return point_to_line(p, a);
}
Point projection(Point p, Line a) {
  return a.s + (((a.e - a.s) * dot(a.e - a.s, p - a.s)) / (a.e - a.s).len2());
}
Point symmetry(Point p, Line a) {
  Point q = projection(p, a);
  return Point(2 * q.x - p.x, 2 * q.y - p.y);
}
Line vector_move_inward(Line line, double d) {
  double len = line.length();
  Point p((line.s.y - line.e.y) * d / len, (line.e.x - line.s.x) * d / len);
  return Line(line.s + p, line.e + p);
}
struct Circle {
  Point p;
  double r;
  Circle() {}
  Circle(Point _p, double _r) : p(_p), r(_r) {}
  Circle(double a, double b, double _r) {
    p = Point(a, b);
    r = _r;
  }
  void input() {
    p.input();
    scanf("%lf", &r);
  }
  void output() {
    p.output();
    printf("%.2f\n", r);
  }
  bool operator==(const Circle &a) const {
    return p == a.p && (dcmp(r - a.r) == 0);
  }
  double area() { return pi * r * r; }
  double circumference() { return 2 * pi * r; }
};
int relation(Point p, Circle a) {
  double d = dis(p, a.p);
  if (dcmp(d - a.r) == 0) return 1;
  return (dcmp(d - a.r) < 0 ? 2 : 0);
}
int relation(Line a, Circle b) {
  double p = point_to_line(b.p, a);
  if (dcmp(p - b.r) == 0) return 1;
  return (dcmp(p - b.r) < 0 ? 2 : 0);
}
int relation(Circle a, Circle v) {
  double d = dis(a.p, v.p);
  if (dcmp(d - a.r - v.r) > 0) return 5;
  if (dcmp(d - a.r - v.r) == 0) return 4;
  double l = fabs(a.r - v.r);
  if (dcmp(d - l) > 0) return 3;
  if (dcmp(d - l) == 0) return 2;
  return 1;
}
Circle triangle_out_circle(Point a, Point b, Point c) {
  Line u = Line((a + b) / 2, ((a + b) / 2) + (b - a).rotate_left());
  Line v = Line((b + c) / 2, ((b + c) / 2) + (c - b).rotate_left());
  Point p = line_intersection(u, v);
  double r = dis(p, a);
  return Circle(p, r);
}
Circle triangle_in_circle(Point a, Point b, Point c) {
  Line u, v;
  double m = atan2(b.y - a.y, b.x - a.x), n = atan2(c.y - a.y, c.x - a.x);
  u.s = a;
  u.e = u.s + Point(cos((n + m) / 2), sin((n + m) / 2));
  v.s = b;
  m = atan2(a.y - b.y, a.x - b.x), n = atan2(c.y - b.y, c.x - b.x);
  v.e = v.s + Point(cos((n + m) / 2), sin((n + m) / 2));
  Point p = line_intersection(u, v);
  double r = point_to_seg(p, Line(a, b));
  return Circle(p, r);
}
int circle_intersection(Circle a, Circle v, Point &p1, Point &p2) {
  int rel = relation(a, v);
  if (rel == 1 || rel == 5) return 0;
  double d = dis(a.p, v.p);
  double l = (d * d + a.r * a.r - v.r * v.r) / (2 * d);
  double h = sqrt(a.r * a.r - l * l);
  Point tmp = a.p + (v.p - a.p).change_len(l);
  p1 = tmp + ((v.p - a.p).rotate_left().change_len(h));
  p2 = tmp + ((v.p - a.p).rotate_right().change_len(h));
  if (rel == 2 || rel == 4) return 1;
  return 2;
}
int line_circle_intersection(Line v, Circle u, Point &p1, Point &p2) {
  if (!relation(v, u)) return 0;
  Point a = projection(u.p, v);
  double d = point_to_line(u.p, v);
  d = sqrt(u.r * u.r - d * d);
  if (dcmp(d) == 0) {
    p1 = a, p2 = a;
    return 1;
  }
  p1 = a + (v.e - v.s).change_len(d);
  p2 = a - (v.e - v.s).change_len(d);
  return 2;
}
int get_circle(Point a, Point b, double r1, Circle &c1, Circle &c2) {
  Circle x(a, r1), y(b, r1);
  int t = circle_intersection(x, y, c1.p, c2.p);
  if (!t) return 0;
  c1.r = c2.r = r1;
  return t;
}
int get_circle(Line u, Point q, double r1, Circle &c1, Circle &c2) {
  double d = point_to_line(q, u);
  if (dcmp(d - r1 * 2) > 0) return 0;
  if (dcmp(d) == 0) {
    c1.p = q + ((u.e - u.s).rotate_left().change_len(r1));
    c2.p = q + ((u.e - u.s).rotate_right().change_len(r1));
    c1.r = c2.r = r1;
    return 2;
  }
  Line u1 = Line(u.s + (u.e - u.s).rotate_left().change_len(r1),
                 u.e + (u.e - u.s).rotate_left().change_len(r1));
  Line u2 = Line(u.s + (u.e - u.s).rotate_right().change_len(r1),
                 u.e + (u.e - u.s).rotate_right().change_len(r1));
  Circle cc = Circle(q, r1);
  Point p1, p2;
  if (!line_circle_intersection(u1, cc, p1, p2))
    line_circle_intersection(u2, cc, p1, p2);
  c1 = Circle(p1, r1);
  if (p1 == p2) {
    c2 = c1;
    return 1;
  }
  c2 = Circle(p2, r1);
  return 2;
}
int get_circle(Line u, Line v, double r1, Circle &c1, Circle &c2, Circle &c3,
               Circle &c4) {
  if (is_parallel(u, v)) return 0;
  Line u1 = Line(u.s + (u.e - u.s).rotate_left().change_len(r1),
                 u.e + (u.e - u.s).rotate_left().change_len(r1));
  Line u2 = Line(u.s + (u.e - u.s).rotate_right().change_len(r1),
                 u.e + (u.e - u.s).rotate_right().change_len(r1));
  Line v1 = Line(v.s + (v.e - v.s).rotate_left().change_len(r1),
                 v.e + (v.e - v.s).rotate_left().change_len(r1));
  Line v2 = Line(v.s + (v.e - v.s).rotate_right().change_len(r1),
                 v.e + (v.e - v.s).rotate_right().change_len(r1));
  c1.r = c2.r = c3.r = c4.r = r1;
  c1.p = line_intersection(u1, v1);
  c2.p = line_intersection(u1, v2);
  c3.p = line_intersection(u2, v1);
  c4.p = line_intersection(u2, v2);
  return 4;
}
int get_circle(Circle cx, Circle cy, double r1, Circle &c1, Circle &c2) {
  Circle x(cx.p, r1 + cx.r), y(cy.p, r1 + cy.r);
  int t = circle_intersection(x, y, c1.p, c2.p);
  if (!t) return 0;
  c1.r = c2.r = r1;
  return t;
}
Circle get_circle(Point a, Point b, double k) {
  double k2 = k * k;
  double d = (2 * b.x - 2 * a.x / k2) / ((1 / k2) - 1);
  double e = (2 * b.y - 2 * a.y / k2) / ((1 / k2) - 1);
  double f = (a.x * a.x / k2 - b.x * b.x + a.y * a.y / k2 - b.y * b.y) /
             ((1 / k2) - 1);
  double cx = -d / 2, cy = -e / 2;
  double r = sqrt((d * d + e * e) / 4 - f);
  return Circle(Point(cx, cy), r);
}
bool get_circle(Point a, Point b, double r, Point &res1, Point &res2) {
  if (dcmp(dis(a, b) - 2 * r) > 0) return 0;
  Point mid((a.x + b.x) / 2, (a.y + b.y) / 2);
  double angle = atan2(b.y - a.y, b.x - a.x),
         d = sqrt(r * r - sqr(dis(a, b) / 2));
  res1 = Point(mid.x + d * sin(angle), mid.y - d * cos(angle));
  res2 = Point(mid.x - d * sin(angle), mid.y + d * cos(angle));
  return 1;
}
Circle get_circle(Point p1, Point p2, Point p3) {
  if (dcmp(cross(p2 - p1, p3 - p1)) == 0) {
    if (p2 < p1) swap(p1, p2);
    if (p3 < p1) swap(p1, p3);
    if (p3 < p2) swap(p2, p3);
    return Circle((p1 + p3) / 2, dis(p1, p3) / 2);
  }
  double x1 = p1.x, x2 = p2.x, x3 = p3.x;
  double y1 = p1.y, y2 = p2.y, y3 = p3.y;
  double a = x1 - x2, b = y1 - y2, c = x1 - x3, d = y1 - y3;
  double e = ((x1 * x1 - x2 * x2) + (y1 * y1 - y2 * y2)) / 2;
  double f = ((x1 * x1 - x3 * x3) + (y1 * y1 - y3 * y3)) / 2;
  double delta = b * c - a * d;
  Point pc = Point(-(d * e - b * f) / delta, -(a * f - c * e) / delta);
  return Circle(pc, dis(pc, p1));
}
int tan_line(Point q, Circle a, Line &u, Line &v) {
  int x = relation(q, a);
  if (x == 2) return 0;
  if (x == 1) {
    u = Line(q, q + (q - a.p).rotate_left());
    v = u;
    return 1;
  }
  double d = dis(a.p, q);
  double l = a.r * a.r / d;
  double h = sqrt(a.r * a.r - l * l);
  u = Line(
      q, a.p + (q - a.p).change_len(l) + (q - a.p).rotate_left().change_len(h));
  v = Line(q, a.p + (q - a.p).change_len(l) +
                  (q - a.p).rotate_right().change_len(h));
  return 2;
}
double area_circle(Circle a, Circle v) {
  int rel = relation(a, v);
  if (rel >= 4) return 0;
  if (rel <= 2) return min(a.area(), v.area());
  double d = dis(a.p, v.p);
  double hf = (a.r + v.r + d) / 2;
  double ss = 2 * sqrt(hf * (hf - a.r) * (hf - v.r) * (hf - d));
  double a1 = acos((a.r * a.r + d * d - v.r * v.r) / (2 * a.r * d));
  a1 = a1 * a.r * a.r;
  double a2 = acos((v.r * v.r + d * d - a.r * a.r) / (2 * v.r * d));
  a2 = a2 * v.r * v.r;
  return a1 + a2 - ss;
}
double circle_traingle_area(Point a, Point b, Circle c) {
  Point p = c.p;
  double r = c.r;
  if (dcmp(cross(p - a, p - b)) == 0) return 0;
  Point q[5];
  int len = 0;
  q[len++] = a;
  Line l(a, b);
  Point p1, p2;
  if (line_circle_intersection(l, c, q[1], q[2]) == 2) {
    if (dcmp(dot(a - q[1], b - q[1])) < 0) q[len++] = q[1];
    if (dcmp(dot(a - q[2], b - q[2])) < 0) q[len++] = q[2];
  }
  q[len++] = b;
  if (len == 4 && dcmp(dot(q[0] - q[1], q[2] - q[1])) > 0) swap(q[1], q[2]);
  double res = 0;
  for (int i = 0; i < len - 1; i++) {
    if (relation(q[i], c) == 0 || relation(q[i + 1], c) == 0) {
      double arg = rad(q[i] - p, q[i + 1] - p);
      res += r * r * arg / 2;
    } else
      res += fabs(cross(q[i] - p, q[i + 1] - p)) / 2;
  }
  return res;
}
int circle_cover_point(Point *p, int n, double r) {
  int ans = 1;
  pair<double, int> angle[MAXN];
  for (int i = 0; i < n; i++) {
    int m = 0;
    double d;
    for (int j = 0; j < n; j++)
      if (dcmp((d = dis(p[i], p[j])) - 2 * r) <= 0 && i != j) {
        double delta = acos(d / (2 * r)), polar = (p[j] - p[i]).polar();
        angle[m++] = make_pair(polar - delta, 1);
        angle[m++] = make_pair(polar + delta, -1);
      }
    sort(angle, angle + m);
    for (int j = 0, sum = 1; j < m; j++) {
      sum += angle[j].second;
      ans = max(ans, sum);
    }
  }
  return ans;
}
Circle circle_min_conver(Point *p, int n) {
  Point center = p[0];
  double r = 0;
  random_shuffle(p, p + n);
  for (int i = 1; i < n; i++) {
    if (dcmp(dis(center, p[i]) - r) > 0) {
      center = p[i], r = 0;
      for (int j = 0; j < i; j++) {
        if (dcmp(dis(center, p[j]) - r) > 0) {
          center = (p[i] + p[j]) / 2, r = dis(center, p[j]);
          for (int k = 0; k < j; k++) {
            if (dcmp(dis(center, p[k]) - r) > 0) {
              center = get_circle(p[i], p[j], p[k]).p;
              r = dis(center, p[i]);
            }
          }
        }
      }
    }
  }
  return Circle(center, r);
}
bool counter_wise(Point *p, int n) {
  for (int i = 1; i < n - 1; i++)
    if (dcmp(cross(p[i] - p[i - 1], p[i + 1] - p[i - 1])) > 0)
      return 0;
    else if (dcmp(cross(p[i] - p[i - 1], p[i + 1] - p[i - 1])) < 0) {
      reverse(p, p + n);
      return 1;
    }
  return 1;
}
bool clock_wise(Point *p, int n) {
  for (int i = 1; i < n - 1; i++)
    if (dcmp(cross(p[i] - p[i - 1], p[i + 1] - p[i - 1])) < 0)
      return 0;
    else if (dcmp(cross(p[i] - p[i - 1], p[i + 1] - p[i - 1])) > 0) {
      reverse(p, p + n);
      return 1;
    }
  return 1;
}
bool is_convex(Point *p, int n) {
  for (int i = 0; i < n; i++) {
    int j = (i + 1) % n;
    int k = (j + 1) % n;
    if (dcmp(cross(p[j] - p[i], p[k] - p[j])) == -1) return 0;
  }
  return 1;
}
double polygon_area(Point *p, int n) {
  double area = 0;
  for (int i = 1; i < n - 1; i++) area += cross(p[i] - p[0], p[i + 1] - p[0]);
  return area / 2;
}
double convex_diameter(Point *p, int n) {
  if (n == 1) return 0;
  if (n == 2) return dis(p[0], p[1]);
  if (n == 3)
    return max(dis(p[0], p[1]), max(dis(p[1], p[2]), dis(p[2], p[0])));
  counter_wise(p, n);
  double ans = 0;
  p[n] = p[0];
  for (int i = 0, j = 2; i < n; i++) {
    while (dcmp(cross(p[i + 1] - p[i], p[j] - p[i]) -
                cross(p[i + 1] - p[i], p[j + 1] - p[i])) < 0)
      j = (j + 1) % n;
    ans = max(ans, max(dis(p[i], p[j]), dis(p[i + 1], p[j])));
  }
  return ans;
}
double convex_min_distance(Point *a, int n, Point *b, int m) {
  int u = 0, v = 0, tmp;
  double ans = INF;
  counter_wise(a, n);
  a[n] = a[0];
  counter_wise(b, m);
  b[m] = b[0];
  for (int i = 0; i < n; i++)
    if (dcmp(a[u].y - a[i].y) > 0) u = i;
  for (int i = 0; i < m; i++)
    if (dcmp(b[v].y - b[i].y) < 0) v = i;
  for (int i = 0; i < n; i++) {
    while ((tmp = dcmp(cross(a[u + 1] - a[u], b[v] - a[u]) -
                       cross(a[u + 1] - a[u], b[v + 1] - a[u]))) < 0)
      v = (v + 1) % m;
    if (tmp == 1)
      ans = min(ans, point_to_seg(b[v], Line(a[u], a[u + 1])));
    else
      ans = min(ans, min(min(point_to_seg(a[u], Line(b[v], b[v + 1])),
                             point_to_seg(a[u + 1], Line(b[v], b[v + 1]))),
                         min(point_to_seg(b[v], Line(a[u], a[u + 1])),
                             point_to_seg(b[v + 1], Line(a[u], a[u + 1])))));
    u = (u + 1) % n;
  }
  return ans;
}
double convex_rectangle_area(Point *p, int n) {
  if (n <= 2) return 0;
  counter_wise(p, n);
  p[n] = p[0];
  int l, r = 1, t = 1;
  double ans = INF;
  for (int i = 0; i < n; i++) {
    while (dcmp(cross(p[i + 1] - p[i], p[t] - p[i]) -
                cross(p[i + 1] - p[i], p[t + 1] - p[i])) < 0)
      t = (t + 1) % n;
    while (dcmp(dot(p[i + 1] - p[i], p[r] - p[i]) -
                dot(p[i + 1] - p[i], p[r + 1] - p[i])) < 0)
      r = (r + 1) % n;
    if (!i) l = r;
    while (dcmp(dot(p[i + 1] - p[i], p[l] - p[i]) -
                dot(p[i + 1] - p[i], p[l + 1] - p[i])) >= 0)
      l = (l + 1) % n;
    double d = dis(p[i + 1], p[i]);
    ans = min(ans, cross(p[i + 1] - p[i], p[t] - p[i]) *
                       (dot(p[i + 1] - p[i], p[r] - p[i]) -
                        dot(p[i + 1] - p[i], p[l] - p[i])) /
                       d / d);
  }
  return ans;
}
int relation(Point a, Point *b, int n) {
  int w = 0;
  b[n] = b[0];
  for (int i = 0; i < n; i++) {
    if (a == b[i] || a == b[i + 1]) return 3;
    if (point_on_seg(a, Line(b[i + 1], b[i]))) return 2;
    int k = dcmp(cross(b[i + 1] - b[i], a - b[i]));
    int d1 = dcmp(b[i].y - a.y);
    int d2 = dcmp(b[i + 1].y - a.y);
    if (k > 0 && d1 <= 0 && d2 > 0) w++;
    if (k < 0 && d2 <= 0 && d1 > 0) w--;
  }
  if (w != 0) return 1;
  return 0;
}
void polygon_cut(Point *p, int &n, Line u) {
  int top = 0;
  Point tmp[MAXN];
  p[n] = p[0];
  for (int i = 0; i < n; i++) {
    int d1 = dcmp(cross(u.e - u.s, p[i] - u.s));
    int d2 = dcmp(cross(u.e - u.s, p[i + 1] - u.s));
    if (d1 >= 0) tmp[top++] = p[i];
    if (d1 * d2 < 0) tmp[top++] = line_intersection(u, Line(p[i], p[i + 1]));
  }
  for (int i = 0; i < top; i++) p[i] = tmp[i];
  n = top;
}
void polygon_cut(Point *p, int &n, double a, double b, double c) {
  int top = 0;
  Point tmp[MAXN];
  p[n] = p[0], p[n + 1] = p[1];
  for (int i = 1; i <= n; i++) {
    if (a * p[i].x + b * p[i].y + c > -eps)
      tmp[top++] = p[i];
    else {
      if (a * p[i - 1].x + b * p[i - 1].y + c > eps)
        tmp[top++] = line_intersection(Line(p[i - 1], p[i]), Line(a, b, c));
      if (a * p[i + 1].x + b * p[i + 1].y + c > eps)
        tmp[top++] = line_intersection(Line(p[i], p[i + 1]), Line(a, b, c));
    }
  }
  for (int i = 0; i < top; i++) p[i] = tmp[i];
  n = top;
}
double polygon_circumference(Point *p, int n) {
  double ans = 0;
  p[n] = p[0];
  for (int i = 0; i < n; i++) ans += dis(p[i], p[i + 1]);
  return ans;
}
double area_polygon_circle(Circle c, Point *p, int n) {
  double ans = 0;
  for (int i = 0; i < n; i++) {
    int j = (i + 1) % n;
    if (dcmp(cross(p[j] - c.p, p[i] - c.p)) >= 0)
      ans += circle_traingle_area(p[i], p[j], c);
    else
      ans -= circle_traingle_area(p[i], p[j], c);
  }
  return fabs(ans);
}
Point centre_of_polygon(Point *p, int n) {
  double sum = 0, sumx = 0, sumy = 0;
  Point p1 = p[0], p2 = p[1], p3;
  for (int i = 2; i < n; i++) {
    p3 = p[i];
    double area = cross(p2 - p1, p3 - p2) / 2;
    sum += area;
    sumx += (p1.x + p2.x + p3.x) * area;
    sumy += (p1.y + p2.y + p3.y) * area;
    p2 = p3;
  }
  return Point(sumx / (3 * sum), sumy / (3 * sum));
}
Point tmp[MAXN];
int convex_hull(Point *p, int n, Point *ch) {
  int m = 0;
  sort(p, p + n);
  for (int i = 0; i < n; i++) {
    while (m > 1 && cross(tmp[m - 1] - tmp[m - 2], p[i] - tmp[m - 1]) <= 0) m--;
    tmp[m++] = p[i];
  }
  int k = m;
  for (int i = n - 2; i >= 0; i--) {
    while (m > k && cross(tmp[m - 1] - tmp[m - 2], p[i] - tmp[m - 1]) <= 0) m--;
    tmp[m++] = p[i];
  }
  if (n > 1) m--;
  for (int i = 0; i < m; i++) ch[i] = tmp[i];
  return m;
}
bool polar_cmp(Line a, Line b) {
  double x = a.polar(), y = b.polar();
  if (dcmp(x - y) == 0) return dcmp(cross(a.e - a.s, b.e - a.s)) < 0;
  return dcmp(x - y) < 0;
}
int half_plane_intersection(Line *line, int n, Point *ch) {
  Line L[MAXN], que[MAXN];
  int head = 0, tail = 1, cnt = 1, num = 0;
  for (int i = 0; i < n; i++) L[i] = line[i];
  sort(L, L + n, polar_cmp);
  for (int i = 1; i < n; i++)
    if (dcmp(L[i].polar() - L[cnt - 1].polar()) != 0) L[cnt++] = L[i];
  que[0] = L[0], que[1] = L[1];
  for (int i = 2; i < cnt; i++) {
    while (tail > head && relation(que[tail] & que[tail - 1], L[i]) == 2)
      tail--;
    while (tail > head && relation(que[head] & que[head + 1], L[i]) == 2)
      head++;
    que[++tail] = L[i];
  }
  while (tail > head && relation(que[tail] & que[tail - 1], que[head]) == 2)
    tail--;
  while (tail > head && relation(que[head] & que[head + 1], que[tail]) == 2)
    head++;
  if (tail - head <= 1) return -1;
  for (int i = head; i <= tail; i++) {
    int j = (i == tail ? head : i + 1);
    ch[num++] = que[i] & que[j];
  }
  return num;
}
double polygon_fermat_point(Point *p, int n, Point &res) {
  double T = 1e10, ans = INF, dt = 0.999;
  Point before(-1, -1);
  while (T > eps) {
    double k = 2.0 * pi * (rand() * 1.0 / RAND_MAX), sum1 = 0, sum2 = 0;
    Point cur(before.x + T * cos(k), before.y + T * sin(k));
    for (int i = 0; i < n; i++) sum1 += dis(p[i], before);
    for (int i = 0; i < n; i++) sum2 += dis(p[i], cur);
    if (dcmp(ans - sum1) >= 0) ans = sum1, res = before;
    if (dcmp(ans - sum2) >= 0) ans = sum2, res = cur;
    if (dcmp(sum1 - sum2) >= 0 ||
        exp((sum1 - sum2) / T) >= (rand() * 1.0 / RAND_MAX))
      before = cur;
    T *= dt;
  }
  return ans;
}
double sphere_distance(double r, double x1, double y1, double x2, double y2) {
  return r * acos(sin(y1) * sin(y2) + cos(y1) * cos(y2) * cos(x1 - x2));
}
double f(double x) { return x * x + x; }
double cal(double l, double r) {
  return (r - l) * (f(l) + f(r) + 4 * f((l + r) / 2)) / 6;
}
double simpson(double l, double r, double ans) {
  double mid = (l + r) / 2, ans1 = cal(l, mid), ans2 = cal(mid, r);
  if (fabs(ans1 + ans2 - ans) <= eps) return ans;
  return simpson(l, mid, ans1) + simpson(mid, r, ans2);
}
int __next[MAXN];
Point pa[MAXN], push_back[MAXN];
struct node {
  long long len;
  double delta;
  node() {}
  node(long long a, double b) { len = a, delta = b; }
  bool operator==(const node &n) const {
    if (len == n.len && (dcmp(delta - n.delta) == 0 ||
                         dcmp(fabs(delta - n.delta) - 2 * pi) == 0))
      return 1;
    return 0;
  }
  bool operator!=(const node &n) const {
    if (len == n.len && (dcmp(delta - n.delta) == 0 ||
                         dcmp(fabs(delta - n.delta) - 2 * pi) == 0))
      return 0;
    return 1;
  }
} infa[MAXN], infb[MAXN];
void get_next(int n) {
  memset(__next, 0, sizeof(__next));
  __next[0] = -1;
  for (int i = 1, k = -1; i < n; i++) {
    while (k != -1 && infa[k + 1] != infa[i]) k = __next[k];
    if (infa[k + 1] == infa[i]) k++;
    __next[i] = k;
  }
}
bool kmp(int n) {
  for (int i = 0, k = -1; i < 2 * n; i++) {
    while (k != -1 && infa[k + 1] != infb[i % n]) k = __next[k];
    if (infa[k + 1] == infb[i % n]) k++;
    if (k == n - 1) return 1;
  }
  return 0;
}
int main(void) {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) pa[i].input();
  for (int i = 0; i < m; i++) push_back[i].input();
  n = convex_hull(pa, n, pa);
  m = convex_hull(push_back, m, push_back);
  if (n != m) return puts("NO"), 0;
  for (int i = 0; i < n; i++)
    infa[i] = node((pa[(i + 1) % n] - pa[i]).len2(),
                   (pa[(i + 1) % n] - pa[i]).polar() -
                       (pa[i] - pa[(i - 1 + n) % n]).polar()),
    infb[i] = node((push_back[(i + 1) % n] - push_back[i]).len2(),
                   (push_back[(i + 1) % n] - push_back[i]).polar() -
                       (push_back[i] - push_back[(i - 1 + n) % n]).polar());
  get_next(n);
  if (kmp(n))
    puts("YES");
  else
    puts("NO");
  return 0;
}