#include <bits/stdc++.h>
using namespace std;
string s;
long long a, b;
long long A[(int)1e6 + 100], Ten[(int)1e6 + 100];
int main() {
  cin >> s >> a >> b;
  Ten[0] = 1;
  for (int i = 1; i < s.size(); ++i) Ten[i] = (Ten[i - 1] * 10) % b;
  long long cur = 0;
  A[s.size() - 1] = (s[s.size() - 1] - '0') % b;
  int cnt = 1;
  for (long long i = s.size() - 2; i >= 0; --i) {
    A[i] = (((s[i] - '0') * Ten[cnt++]) % b + A[i + 1]) % b;
  }
  for (long long i = 0; i < s.size() - 1; ++i) {
    cur = ((cur * 10) % a + s[i] - '0') % a;
    if (cur == 0) {
      if (s[i + 1] != '0' && A[i + 1] == 0) {
        cout << "YES" << endl;
        cout << s.substr(0, i + 1) << endl;
        cout << s.substr(i + 1) << endl;
        return 0;
      }
    }
  }
  cout << "NO" << endl;
  return 0;
}
