#include <bits/stdc++.h>
using namespace std;
long long dp[200005];
long long exp(long long base, long long e, long long MOD) {
  long long result = 1;
  base %= MOD;
  while (e) {
    if (e & 1) result = result * base % MOD;
    base = base * base % MOD;
    e >>= 1;
  }
  return result;
}
void solve() {
  string x;
  cin >> x;
  long long p, q;
  cin >> p >> q;
  long long n = x.size();
  if (n == 1) {
    cout << "NO" << '\n';
    return;
  } else {
    long long l = 0, r = 0;
    for (long long i = 0; i < n; i++) {
      r *= 10;
      r += (x[i] - '0');
      if (r > q) r %= q;
    }
    for (long long i = 0; i < n - 1; i++) {
      l *= 10;
      l += (x[i] - '0');
      if (l > p) l %= p;
      r -= (x[i] - '0') * exp(10, n - 1 - i, q);
      if (r < 0) {
        r %= q;
        r += q;
      }
      l %= p, r %= q;
      if (x[i + 1] != '0' && l == 0 && r == 0) {
        cout << "YES" << '\n';
        cout << x.substr(0, i + 1) << '\n';
        cout << x.substr(i + 1) << '\n';
        return;
      }
    }
    cout << "NO" << '\n';
  }
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr), cout.tie(nullptr);
  long long t = 1;
  while (t--) solve();
  return 0;
}
