#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;
  long long n = s.size(), a, b, k = 10, pref[n], suff[n];
  cin >> a >> b;
  pref[0] = (s[0] - '0') % a;
  for (long long i = 1; i < n; ++i)
    pref[i] = (pref[i - 1] * 10 + (s[i] - '0')) % a;
  suff[n - 1] = (s[n - 1] - '0') % b;
  for (long long i = n - 2; i >= 0; --i) {
    suff[i] = (suff[i + 1] + (s[i] - '0') * k) % b;
    k = (k * 10) % b;
  }
  for (long long i = 1; i < n; ++i) {
    if (s[0] > '0' && s[i] > '0' && pref[i - 1] == 0 && suff[i] == 0) {
      cout << "YES\n";
      cout << s.substr(0, i) << "\n";
      cout << s.substr(i, n - i) << "\n";
      return 0;
    }
  }
  cout << "NO\n";
  return 0;
}
