#include <bits/stdc++.h>
using namespace std;
int main(void) {
  string s;
  int a, b, length, pointer, ptr;
  bool t = false;
  vector<int> lp;
  deque<int> rp, ten;
  cin >> s >> a >> b;
  length = s.length();
  ptr = length - 2;
  ten.push_back(1 % b);
  rp.push_back((s[length - 1] - '0') * ten[0]);
  lp.push_back(((s[0] - '0') * 1 % a));
  for (pointer = 0; pointer < length - 1; pointer++) {
    if (pointer != 0) {
      lp.push_back((lp[pointer - 1] * 10 + s[pointer] - '0') % a);
      int temp = (ten[0] * 10) % b;
      ten.push_front(temp);
      temp = ((s[ptr] - '0') * (ten[0]) + (rp[0])) % b;
      rp.push_front(temp);
      --ptr;
    }
  }
  for (pointer = 0; pointer < length - 1; pointer++)
    if (((lp[pointer] % a) == 0) && ((rp[pointer] % b) == 0) &&
        (s[pointer + 1] != '0')) {
      t = true;
      break;
    }
  if (t) {
    cout << "YES" << endl
         << s.substr(0, pointer + 1) << endl
         << s.substr(pointer + 1, length - pointer - 1);
  } else
    cout << "NO" << endl;
  return 0;
}
