#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-4;
const long double PI = acos((long double)-1.0);
const long long int MOD = 1e9 + 7;
long long int powmod(long long int a, long long int b, long long int mod) {
  long long int res = 1;
  a %= mod;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
const int debug = 1;
template <typename T, typename S>
void DBG(pair<T, S> p) {
  if (debug) cout << p.first << " " << p.second << endl;
}
template <typename T>
void DBG(vector<T> v) {
  if (debug) {
    for (T t : v) cout << t << "  ";
    cout << endl;
  }
}
template <typename T>
void DBG(T t) {
  if (debug) cout << t << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.precision(10);
  cout << fixed;
  string s;
  cin >> s;
  long long int a, b;
  cin >> a >> b;
  long long int n = 0;
  long long int m = 0;
  long long int t = 1;
  set<int> se;
  for (int i = 0; i < (s.size() - 1); ++i) {
    n = (10 * n + s[i] - '0') % a;
    if (n == 0) {
      se.insert(i + 1);
    }
  }
  for (int i = 0; i < (s.size() - 1); ++i) {
    m = (m + t * (s[s.size() - 1 - i] - '0')) % b;
    if (m == 0 && s[s.size() - 1 - i] != '0' && se.count(s.size() - 1 - i)) {
      cout << "YES" << endl
           << s.substr(0, (s.size() - 1 - i)) << endl
           << s.substr((s.size() - 1 - i)) << endl;
      return 0;
    }
    t = (t * 10) % b;
  }
  cout << "NO" << endl;
}
