#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int a, b;
  cin >> a >> b;
  int n = s.size();
  vector<int> v(n);
  v[0] = (s[0] - '0') % a;
  for (int i = 1; i < n - 1; i++) v[i] = (v[i - 1] * 10 + s[i] - '0') % a;
  int rem = 0, p = 1;
  for (int i = n - 1; i > 0; i--) {
    rem = (p * (s[i] - '0') + rem) % b;
    p = (p * 10) % b;
    if (rem == 0 && s[i] != '0' && v[i - 1] == 0) {
      cout << "YES" << endl;
      cout << s.substr(0, i) << endl << s.substr(i) << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
  return 0;
}
