#include <bits/stdc++.h>
using namespace std;
bool diva[1000000];
bool divb[1000000];
int main() {
  string key;
  long long a, b;
  cin >> key >> a >> b;
  long long rema = 0;
  for (int i = 0; i < key.size(); i++) {
    rema = rema * 10 + (key[i] - '0');
    rema %= a;
    if (rema == 0) diva[i] = true;
  }
  long long remb = 0;
  long long power = 1;
  for (int i = key.size() - 1; i >= 0; i--) {
    remb += (key[i] - '0') * power;
    remb %= b;
    power *= 10;
    power %= b;
    if (remb == 0 && key[i] != '0') divb[i] = true;
  }
  for (int i = 0; i < key.size() - 1; i++) {
    if (diva[i] && divb[i + 1]) {
      cout << "YES" << endl;
      cout << key.substr(0, i + 1) << endl << key.substr(i + 1);
      return 0;
    }
  }
  cout << "NO";
  return 0;
}
