#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, l, r;
  cin >> s;
  long long a, b, n;
  cin >> a >> b;
  n = s.size();
  long long ar[n];
  long long br[n];
  ar[n - 1] = -1;
  br[0] = -1;
  ar[0] = (s[0] - '0') % a;
  br[n - 1] = (s[n - 1] - '0') % b;
  for (int i = 1; i < n - 1; i++) {
    ar[i] = ((ar[i - 1] * 10) % a + (s[i] - '0')) % a;
  }
  long long x = 10;
  for (int i = n - 2; i >= 1; i--) {
    br[i] = (br[i + 1] + ((s[i] - '0') * x)) % b;
    x = (x * 10) % b;
  }
  int d = -1;
  for (int i = 0; i < n; i++) {
    if (s[i + 1] == '0') continue;
    if (ar[i] == 0 && br[i + 1] == 0) {
      cout << "YES" << '\n';
      d = i;
      break;
    }
  }
  if (d == -1) {
    cout << "NO";
    return 0;
  }
  cout << s.substr(0, d + 1) << '\n' << s.substr(d + 1, n - d + 1);
  return 0;
}
