#include <bits/stdc++.h>
using namespace std;
void imprimirVector(vector<int> v) {
  if (!v.empty()) {
    int p = v.size();
    cout << "[";
    for (int i = 0; i < (int)(p - 1); i++) cout << v[i] << ",";
    cout << v[p - 1] << "]" << endl;
  } else
    cout << "[]" << endl;
}
int main() {
  string n;
  int a, b;
  cin >> n >> a >> b;
  int maxN = n.size();
  vector<int> aPot(maxN);
  vector<int> bPot(maxN);
  int ra = 1;
  int rb = 1;
  for (int i = 0; i < (int)(maxN); i++) {
    aPot[i] = ra;
    bPot[i] = rb;
    ra = (ra * 10) % a;
    rb = (rb * 10) % b;
  }
  int sa = 0;
  int sb = 0;
  for (int i = 0; i < (int)(maxN); i++) {
    string str;
    str = n[i];
    int h1 = atoi(str.c_str());
    sb += (bPot[maxN - i - 1] * h1) % b;
    sb %= b;
  }
  for (int i = 0; i < (int)(maxN - 1); i++) {
    string str1;
    str1 = n[i];
    int h2 = atoi(str1.c_str());
    sa = (sa * 10 + h2) % a;
    sb = (sb - bPot[maxN - i - 1] * h2) % b;
    if (sa == 0 && sb == 0) {
      string p = n.substr(0, i + 1);
      string q = n.substr(i + 1, maxN);
      while (q != "" && q[0] == '0') {
        q = q.substr(1, maxN);
        p += "0";
      }
      if (q != "") {
        cout << "YES" << endl << p << endl << q << endl;
        return 0;
      }
    }
  }
  cout << "NO" << endl;
  return 0;
}
