#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000007;
long long inf = 99999;
int main() {
  long long t, w = 1;
  t = 1;
  while (t--) {
    long long n, i, j, k, m, ans = 0, p, b, a, m1 = INT_MAX, m2 = INT_MIN;
    string s;
    cin >> s;
    cin >> a >> b;
    n = s.size();
    vector<long long> pr(n, 0), su(n, 0);
    pr[0] = (s[0] - 48) % a;
    for (i = 1; i < n; i++) {
      pr[i] = (10 * pr[i - 1] + (s[i] - 48)) % a;
    }
    su[n - 1] = (s[n - 1] - 48) % b;
    k = 10;
    for (i = n - 2; i >= 0; i--) {
      su[i] = (su[i + 1] + k * (s[i] - 48)) % b;
      k = (k * 10) % b;
    }
    for (i = 0; i < n - 1; i++) {
      if (pr[i] == 0 && su[i + 1] == 0 && (s[i + 1] - 48)) break;
    }
    if (i == n - 1)
      cout << "NO" << endl;
    else {
      cout << "YES" << endl;
      cout << s.substr(0, i + 1) << endl;
      cout << s.substr(i + 1) << endl;
    }
  }
  return 0;
}
