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