#include <bits/stdc++.h>
using namespace std;
constexpr int INF = 1e9 + 1;
constexpr long long LLINF = 1e18 + 1;
template <typename T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <typename T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
int mul(int a, int b, int mod) { return a * 1LL * b % mod; }
int add(int a, int b, int mod) {
  a += b;
  if (a >= mod) a -= mod;
  if (a < 0) a += mod;
  return a;
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  string s;
  int a, b, pa = 1, pb = 1, ca = 0, cb = 0, ta = 0, n;
  cin >> s >> a >> b;
  n = s.length();
  vector<int> cur(n);
  for (int i = 0; i < n; i++) {
    ta = add(mul(ta, 10, a), s[i] - '0', a);
    cur[i] = ta;
  }
  for (int i = n - 1; i; i--) {
    ca = add(ca, mul(s[i] - '0', pa, a), a);
    cb = add(cb, mul(s[i] - '0', pb, b), b);
    pa = mul(pa, 10, a);
    pb = mul(pb, 10, b);
    ;
    if (s[i] > '0' && cb == 0 && add(cur[i - 1], 0, a) == 0) {
      printf("YES\n%s\n%s\n", s.substr(0, i).c_str(), s.substr(i).c_str());
      return 0;
    }
  }
  printf("NO\n");
}
