#include <bits/stdc++.h>
using namespace std;
const int MAX = (int)1e6 + 7;
string pk;
long long a, b, fa[MAX], fb[MAX];
int main() {
  cin >> pk >> a >> b;
  int n = pk.size();
  long long f10 = 1;
  for (int i = 0; i < n; ++i) {
    fa[i + 1] = (fa[i] * 10 + pk[i] - '0') % a;
    fb[i + 1] = (f10 * (pk[n - i - 1] - '0')) % b;
    f10 = (f10 * 10) % b;
  }
  for (int i = 0; i < n; ++i) {
    fb[i + 1] = (fb[i + 1] + fb[i]) % b;
  }
  for (int i = 0; i < n - 1; ++i) {
    if (!fa[i + 1] && !fb[n - i - 1] && pk[i + 1] != '0') {
      cout << "YES\n"
           << pk.substr(0, i + 1) << '\n'
           << pk.substr(i + 1) << '\n';
      return 0;
    }
  }
  cout << "NO\n";
  return 0;
}
