#include <bits/stdc++.h>
using namespace std;
void swap(long long int arr[], long long int x, long long int y) {
  long long int temp = arr[x];
  arr[x] = arr[y];
  arr[y] = temp;
}
void print_arr(long long int arr[], long long int n) {
  cout << '\n';
  for (long long int i = 0; i < n; i++) {
    cout << arr[i] << ' ';
  }
  cout << '\n';
}
void input_arr(long long int arr[], long long int n) {
  for (long long int i = 0; i < n; i++) {
    cin >> arr[i];
  }
}
bool primes[1000001];
void seive() {
  memset(primes, true, sizeof(primes));
  primes[0] = false;
  primes[1] = false;
  for (long long int i = 2; i * i <= 1000001; i++) {
    if (primes[i]) {
      for (long long int j = 2 * i; j < 1000001; j += i) {
        primes[j] = false;
      }
    }
  }
}
bool ans = true;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t;
  t = 1;
  while (t--) {
    int n, m;
    cin >> n >> m;
    string s;
    cin >> s;
    string t;
    cin >> t;
    bool ans;
    ans = true;
    if (s[0] == '<' && t[0] == '^') {
      ans = false;
    }
    if (s[n - 1] == '<' && t[0] == 'v') {
      ans = false;
    }
    if (s[0] == '>' && t[m - 1] == '^') {
      ans = false;
    }
    if (s[n - 1] == '>' && t[m - 1] == 'v') {
      ans = false;
    }
    if (ans) {
      cout << "YES";
    } else {
      cout << "NO";
    }
  }
  return 0;
}
