#include <bits/stdc++.h>   using namespace std;   const double EPS = 1e-9;   inline int comp(double A, double B = 0) {     return (A <= B + EPS) ? (A + EPS < B) ? -1 : 0 : 1;   }   struct point {     double x, y;     point(double x = 0, double y = 0) : x(x), y(y) {}     bool operator<(const point &other) const {       if (!comp(x, other.x)) return comp(y, other.y) < 0;       return comp(x, other.x) < 0;     }     point operator+(const point &other) const {       return point(x + other.x, y + other.y);     }     point operator-(const point &other) const {       return point(x - other.x, y - other.y);     }   };   double inner(const point &A, const point &B) { return A.x * B.x + A.y * B.y; }   double outer(const point &A, const point &B) { return A.x * B.y - A.y * B.x; }   double dist(const point &A, const point &B) {     return sqrt(inner(A - B, A - B));   }   double angle(const point &A, const point &O, const point &B) {     return acos(inner(A - O, B - O) / (dist(A, O) * dist(B, O)));   }   int side(const point &A, const point &O, const point &B) {     return comp(outer(A - O, B - O));   }   vector<point> convex_hull(vector<point> &points) {     int size = (int)points.size();     if (size < 3) return points;     point O = *min_element(points.begin(), points.end());     sort(points.begin(), points.end(), [O](const point &A, const point &B) {       double foo = outer(A - O, B - O);       return comp(foo) > 0 or (!comp(foo) and comp(dist(A, O), dist(B, O)) < 0);     });     vector<point> polygon = {points.back(), points[0], points[1]};     for (int i = 2; i < size;)       if (polygon.size() <= 2 or           side(polygon.rbegin()[0], polygon.rbegin()[1], points[i]) > 0)         polygon.push_back(points[i++]);       else         polygon.pop_back();     polygon.pop_back();     return polygon;   }   vector<int> pre_kmp(const vector<double> &A) {     int i = 0, j, size = (int)A.size();     vector<int> back(size + 1);     back[0] = j = -1;     while (i < size) {       while (j >= 0 and comp(A[i], A[j])) j = back[j];       ++i;       ++j;       back[i] = j;     }     return back;   }   vector<int> kmp(const vector<double> &A, const vector<double> &B) {     int i = 0, j = 0, sizea = (int)A.size(), sizeb = (int)B.size();     vector<int> match, back = pre_kmp(B);     while (i < sizea) {       while (j >= 0 and comp(A[i], B[j])) j = back[j];       ++i;       ++j;       if (j == sizeb) {         match.push_back(i - j);         j = back[j];       }     }     return match;   }   vector<double> stringify(const vector<point> &P) {     vector<double> foo;     int size = (int)P.size();     for (int i = 0; i < size; ++i) {       foo.push_back(dist(P[i], P[(i + 1) % size]));       foo.push_back(angle(P[i], P[(i + 1) % size], P[(i + 2) % size]));     }     return foo;   }   int main() {     int n, m;     scanf( %d %d , &n, &m);     vector<point> A(n), B(m);     for (int i = 0; i < n; ++i) scanf( %lf %lf , &A[i].x, &A[i].y);     for (int i = 0; i < m; ++i) scanf( %lf %lf , &B[i].x, &B[i].y);     vector<double> X = stringify(convex_hull(A)), Y = stringify(convex_hull(B));     X.insert(X.end(), X.begin(), X.end());     printf( %s n , kmp(X, Y).empty() ?  NO  :  YES );     return 0;   }   