#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using pi = pair<int, int>;
const int mod = 1e9 + 7;
const ll inf = ll(1e18);
const int mxn = 1e3, mxa = 5e4;
string second;
int a, b;
ll fast_pow(int a, int p) {
  ll res = 1;
  while (p) {
    if (p % 2 == 0) {
      a = a * 1ll * a % b;
      p /= 2;
    } else {
      res = res * 1ll * a % b;
      p--;
    }
  }
  return res;
}
void solve() {
  cin >> second >> a >> b;
  int n = (int)(second).size();
  ll l = 0, r = 0;
  for (int i = 0; i < n; ++i) r = (r * 10 + (second[i] - '0')) % b;
  for (int i = 0; i + 1 < n; ++i) {
    l = (l * 10 + (second[i] - '0')) % a;
    r = ((r - (second[i] - '0') * fast_pow(10, n - i - 1)) % b + b) % b;
    if (l == 0 && r == 0 && second[i + 1] != '0') {
      cout << "YES\n";
      cout << second.substr(0, i + 1) << '\n'
           << second.substr(i + 1, n - i - 1) << '\n';
      return;
    }
  }
  cout << "NO\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t;
  t = 1;
  while (t--) solve();
}
