#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e6 + 9;
set<int> ist;
map<string, int> msi;
map<string, string> mss;
map<int, string> mis;
map<int, int> mii;
pair<int, int> pii;
vector<int> v;
vector<pair<int, int> > vv;
int cc[] = {1, -1, 0, 0};
int rr[] = {0, 0, 1, -1};
void LIFT_OFF_SHARK_AP20() {
  string sp;
  long long a, b;
  cin >> sp >> a >> b;
  long long n = sp.size();
  long long pre[n];
  long long suf[n];
  long long t = 0, q = 1;
  for (long long i = 0; i < n; i++) {
    t = ((sp[i] - '0') + t * 10) % a;
    pre[i] = t;
  }
  t = 0;
  for (long long i = n - 1; i > 0; i--) {
    t = ((sp[i] - '0') * q + t) % b;
    q = (q * 10) % b;
    suf[i] = t;
  }
  for (long long i = 1; i < n; i++) {
    if (pre[i - 1] == 0 && suf[i] == 0 && sp[i] != '0') {
      cout << "YES" << endl;
      string s1 = sp.substr(0, i);
      string s2 = sp.substr(i, n - i);
      cout << s1 << endl << s2 << endl;
      return;
    }
  }
  cout << "NO" << endl;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  LIFT_OFF_SHARK_AP20();
  return 0;
}
