#include <bits/stdc++.h>
using namespace std;
bool f[22][22][22][22];
int main() {
  int n, m;
  cin >> n >> m;
  string a, b;
  cin >> a >> b;
  a = " " + a;
  b = " " + b;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (a[i] == '>') f[i][j][i][j + 1] = true;
      if (a[i] == '<') f[i][j][i][j - 1] = true;
      if (b[j] == 'v') f[i][j][i + 1][j] = true;
      if (b[j] == '^') f[i][j][i - 1][j] = true;
    }
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) f[i][j][i][j] = true;
  for (int kx = 1; kx <= n; kx++)
    for (int ky = 1; ky <= m; ky++)
      for (int ix = 1; ix <= n; ix++)
        for (int iy = 1; iy <= m; iy++)
          for (int jx = 1; jx <= n; jx++)
            for (int jy = 1; jy <= m; jy++)
              if (f[ix][iy][kx][ky] && f[kx][ky][jx][jy])
                f[ix][iy][jx][jy] = true;
  bool ans = true;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      for (int x = 1; x <= n; x++)
        for (int y = 1; y <= m; y++)
          if (f[i][j][x][y] == false) ans = false;
  if (ans == false)
    cout << "NO" << endl;
  else
    cout << "YES" << endl;
  return 0;
}
