#include <bits/stdc++.h>
using namespace std;
ifstream fin;
ofstream fout;
int main(int argc, char *argv[]) {
  if (argc == 3) {
    fin.open(argv[1]);
    fout.open(argv[2]);
  }
  string s;
  int a, b;
  cin >> s;
  cin >> a >> b;
  int len = s.length();
  bool modu_f[s.length()];
  memset(modu_f, false, sizeof(modu_f));
  int mod = (s[0] - '0') % a;
  (mod == 0) ? modu_f[0] = true : modu_f[0] = false;
  for (int i = 1; i < len; i++) {
    mod = ((s[i] - '0') + mod * 10) % a;
    if (mod == 0) modu_f[i] = true;
  }
  int modu_b[len];
  memset(modu_b, false, sizeof(modu_b));
  mod = (s[len - 1] - '0') % b;
  (mod == 0 && (s[len - 1] - '0' != 0)) ? modu_b[len - 1] = true
                                        : modu_b[len - 1] = false;
  int p = 10;
  for (int i = len - 2; i >= 0; i--) {
    if (s[i] - '0' == 0) {
      p = (p * 10) % b;
      continue;
    }
    mod = (mod + (s[i] - '0') * p) % b;
    if (mod == 0) modu_b[i] = true;
    p = (p * 10) % b;
  }
  for (int i = 0; i < len - 1; i++) {
    if (modu_f[i] == true && modu_b[i + 1] == true) {
      cout << "YES" << endl;
      cout << s.substr(0, i + 1) << endl;
      cout << s.substr(i + 1) << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
  return 0;
}
