#include <bits/stdc++.h>
using namespace std;
const long double pi = 3.14159265358979323846;
long long MOD = 1e9 + 7;
const char nl = '\n';
const long long inf = pow(2, 10);
long long power(long long x, long long y) {
  long long z = 1;
  while (y > 0) {
    if (y % 2) z = z * x;
    x = x * x;
    y /= 2;
  }
  return z;
}
long long gcd(long long a, long long b) {
  if (a < b) return gcd(b, a);
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long sq(long long a) {
  long long ans = (1ll * a * a);
  return ans;
}
bool isprime(long long n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (long long i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
long long digitsum(long long x) {
  long long ans = 0;
  while (x > 0) {
    ans += (x % 10);
    x /= 10;
  }
  return ans;
}
vector<vector<int>> g(401);
int vis[401] = {0};
void DFS(int node) {
  vis[node] = 1;
  for (int i = 0; i < g[node].size(); i++) {
    if (vis[g[node][i]] == 0) {
      DFS(g[node][i]);
    }
  }
}
void solve() {
  int n, m;
  cin >> n >> m;
  string x, y;
  cin >> x;
  cin >> y;
  int a[n][m];
  int num = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      a[i][j] = num;
      num++;
    }
  }
  for (int i = 0; i < n; i++) {
    if (x[i] == '<') {
      for (int j = m - 1; j >= 1; j--) {
        g[a[i][j]].push_back(a[i][j - 1]);
      }
    } else {
      for (int j = 0; j < m - 1; j++) {
        g[a[i][j]].push_back(a[i][j + 1]);
      }
    }
  }
  for (int j = 0; j < m; j++) {
    if (y[j] == '^') {
      for (int i = n - 1; i >= 1; i--) {
        g[a[i][j]].push_back(a[i - 1][j]);
      }
    } else {
      for (int i = 0; i < n - 1; i++) {
        g[a[i][j]].push_back(a[i + 1][j]);
      }
    }
  }
  int ans = 1;
  for (int i = 1; i <= n * m; i++) {
    memset(vis, 0, sizeof(vis));
    DFS(i);
    int temp = 0;
    for (int j = 1; j <= n * m; j++) {
      if (vis[j] == 1) {
        temp++;
      }
    }
    if (temp != n * m) {
      ans = 0;
      break;
    }
  }
  if (ans == 0) {
    cout << "NO\n";
  } else {
    cout << "YES\n";
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  long long TC = 1;
  while (TC--) {
    solve();
  }
}
