#include <bits/stdc++.h>
using namespace std;
char c[30][30], d[30][30];
int main() {
  int n, m, i, j;
  cin >> n >> m;
  string s1, s2;
  cin >> s1 >> s2;
  for (i = 0; i < n; i++)
    for (j = 0; j < m; j++) c[i][j] = s1[i];
  for (i = 0; i < n; i++)
    for (j = 0; j < m; j++) d[i][j] = s2[j];
  int x = 0;
  if (c[0][0] == '>' && d[0][0] == 'v') x = 1;
  if (c[0][0] == '<' && d[0][0] == '^') x = 1;
  if (c[0][m - 1] == '>' && d[0][m - 1] == '^') x = 1;
  if (c[0][m - 1] == '<' && d[0][m - 1] == 'v') x = 1;
  if (c[n - 1][0] == '>' && d[n - 1][0] == '^') x = 1;
  if (c[n - 1][0] == '<' && d[n - 1][0] == 'v') x = 1;
  if (c[n - 1][m - 1] == '>' && d[n - 1][m - 1] == 'v') x = 1;
  if (c[n - 1][m - 1] == '<' && d[n - 1][m - 1] == '^') x = 1;
  if (x)
    cout << "NO\n";
  else
    cout << "YES\n";
  return 0;
}
