#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  string s;
  cin >> s;
  int a, b;
  cin >> a >> b;
  const int n = s.size();
  int prefix[n], suffix[n];
  memset(prefix, 0, sizeof(prefix));
  memset(suffix, 0, sizeof(suffix));
  for (int i = 0; i < n; ++i) {
    int rem = (i > 0 ? prefix[i - 1] : 0);
    prefix[i] = (rem * 10 + s[i] - '0') % a;
  }
  int curr_pow = 1;
  for (int i = n - 1; i >= 0; --i) {
    int rem = (i < n - 1 ? suffix[i + 1] : 0);
    suffix[i] = ((s[i] - '0') * curr_pow + rem) % b;
    curr_pow *= 10;
    curr_pow %= b;
  }
  for (int i = 0; i < n - 1; ++i) {
    if (prefix[i] == 0 and s[i + 1] != '0' and suffix[i + 1] == 0) {
      cout << "YES\n";
      cout << s.substr(0, i + 1) << '\n' << s.substr(i + 1);
      return 0;
    }
  }
  cout << "NO";
  return 0;
}
