#include <bits/stdc++.h>   using namespace std;   int main() {     long n, m, i, j;     char x[2], y[2], t;     cin >> n >> m;     cin >> x[0];     for (i = 2; i < n; i++) cin >> t;     cin >> x[1] >> y[0];     y[0] = (y[0] ==  ^ ) ?  >  :  < ;     for (j = 2; j < m; j++) cin >> t;     cin >> y[1];     y[1] = (y[1] ==  ^ ) ?  >  :  < ;     if (x[0] == y[0] && x[1] == y[1] && x[0] != x[1])       cout <<  YES ;     else       cout <<  NO ;   }   