#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr int n_max = 1e6;
int rem1[n_max];
int key[n_max];
void print(int* start, int* end) {
  while (start != end) {
    cout << *start << '\t';
    start++;
  }
  cout << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string key_s;
  cin >> key_s;
  int a, b, n;
  cin >> a >> b;
  n = key_s.size();
  for (int i = 0; i < n; ++i) key[0] = key_s[0] - '0';
  rem1[0] = key[0] % a;
  for (int i = 1; i < n; ++i) {
    key[i] = key_s[i] - '0';
    rem1[i] = (10 * rem1[i - 1] + key[i]) % a;
  }
  int prev_rem = 0;
  int pow10 = 1;
  for (int i = n - 1; i > 0; --i) {
    int rem2 = i == n - 1 ? key[n - 1] % b : (pow10 * key[i] + prev_rem) % b;
    if (rem1[i - 1] == 0 && rem2 == 0 && key[i] != 0) {
      cout << "YES" << endl
           << key_s.substr(0, i) << endl
           << key_s.substr(i, n - (i)) << endl;
      return 0;
    }
    prev_rem = rem2;
    pow10 = 10 * pow10 % b;
  }
  cout << "NO";
  return 0;
}
