#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T gcd(T a, T b) {
  return (!b ? a : gcd(b, a % b));
}
template <class T>
inline T ABS(T x) {
  return ((x) > 0 ? (x) : (-(x)));
}
const int N = 1 << 20;
int fr[N], bk[N];
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  string s;
  cin >> s;
  int a, b;
  cin >> a >> b;
  int num = 0;
  for (int i = 0; i < int((s).size()); ++i) {
    num = num * 10 + s[i] - 48;
    if (num >= a) {
      num %= a;
    }
    fr[i] = num;
  }
  num = 0;
  int mul = 1;
  for (int i = int((s).size()) - 1; i >= 0; --i) {
    num = (s[i] - 48) * mul + num;
    if (num >= b) {
      num %= b;
    }
    bk[i] = num;
    mul *= 10;
    if (mul >= b) {
      mul %= b;
    }
  }
  for (int i = 1; i < int((s).size()); ++i) {
    if (fr[i - 1] == 0 && bk[i] == 0 && s[i] != '0') {
      cout << "YES\n";
      for (int ii = 0; ii < int((s).size()); ++ii) {
        cout << s[ii];
        if (ii == i - 1) cout << '\n';
      }
      return 0;
    }
  }
  cout << "NO";
}
