[TASK]:
You will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.

[INSTRUCTION]:
The following libraries are already included in the code.
```cpp
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <fstream>
#include <climits>
#include <cassert>
#include <iomanip>
#include <sstream>
#include <bitset>
using namespace std;
```
Do not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.

[PSEUDOCODE]:
define the main function
    make ints i and j
    make int array vis of size 220 with array of size 220 with {0}
    make integer array vis1 of size 220 with array of size 220 with {0}
    make int arrays x of size 5, y of size 5, x1 of size 5, and y1 of size 5
    for i = 0 to 4 exclusive, read x[i] and y[i]
    for i = 0 to 4 exclusive, read x1[i] and y1[i]
    sort x using x + 4
    sort x1 using x1 + 4
    sort y using y + 4
    sort y1 using y1 + 4
    make integer ox = min(x[0], x1[0])
    create int oy = min(y[0], y1[0])
    if ox is less than 0, set ox to -ox
    if oy is less than 0, set oy to -oy
    for i = x[0] + ox to x[3] + ox
        for j = y[0] + oy to y[3] + oy, set vis[i][j] to 1
    make integer mid = (x1[0] + ox + x1[3] + ox) / 2
    create int s = y1[0] + oy
    let int t = y1[3] + oy
    for i = mid to x1[0] + ox
        for j = s to t, set vis1[i][j] to 1
        increment s
        decrease t by 1
    end of the block
    set s to y1[0] + oy
    set t to y1[3] + oy
    for i = mid to x1[3] + ox
        for j = s to t, set vis1[i][j] to 1
        increment s
        decrease t by 1
    end of the block
    for i = 0 to 220 exclusive
        for j = 0 to 220 exclusive
            if vis[i][j] is equal to 1 and vis1[i][j] is equal to 1
                print "YES"
                return to indicate successful execution
            end of the block
        end of the block
    end of the block
    show "NO"
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int i, j;
    int vis[220][220] = {0};
    int vis1[220][220] = {0};
    int x[5], y[5], x1[5], y1[5];
    for (i = 0; i < 4; i++) cin >> x[i] >> y[i];
    for (i = 0; i < 4; i++) cin >> x1[i] >> y1[i];
    sort(x, x + 4);
    sort(x1, x1 + 4);
    sort(y, y + 4);
    sort(y1, y1 + 4);
    int ox = min(x[0], x1[0]);
    int oy = min(y[0], y1[0]);
    if (ox < 0) ox = -ox;
    if (oy < 0) oy = -oy;
    for (i = x[0] + ox; i <= x[3] + ox; i++)
        for (j = y[0] + oy; j <= y[3] + oy; j++) vis[i][j] = 1;
    int mid = (x1[0] + ox + x1[3] + ox) / 2;
    int s = y1[0] + oy;
    int t = y1[3] + oy;
    for (i = mid; i >= x1[0] + ox; i--) {
        for (j = s; j <= t; j++) { vis1[i][j] = 1; }
        s++;
        t--;
    }
    s = y1[0] + oy;
    t = y1[3] + oy;
    for (i = mid; i <= x1[3] + ox; i++) {
        for (j = s; j <= t; j++) { vis1[i][j] = 1; }
        s++;
        t--;
    }
    for (i = 0; i < 220; i++) {
        for (j = 0; j < 220; j++) {
            if (vis[i][j] == 1 && vis1[i][j] == 1) {
                cout << "YES" << endl;
                return 0;
            }
        }
    }
    cout << "NO" << endl;
    return 0;
}