#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e8;
long long powerm(long long a, long long b, long long m) {
  if (b == 0) {
    return 1;
  }
  long long res = powerm(a, b / 2, m);
  if (b % 2) {
    return ((res * res) % m * (a % m)) % m;
  }
  return (res * res) % m;
}
long long power(long long a, long long b) {
  if (b == 0) {
    return 1;
  }
  long long res = power(a, b / 2);
  if (b % 2 == 0) {
    return res * res;
  }
  return res * res * a;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s;
  bool possible = true;
  cin >> s;
  long long a, b, ans = 0;
  cin >> a >> b;
  if (s.size() == 1) {
    possible = false;
  } else {
    vector<pair<long long, long long>> vec(s.size());
    vec[0].first = (s[0] - '0') % a;
    vec[s.size() - 1].second = (s[s.size() - 1] - '0') % b;
    for (long long i = 1; i < s.size(); i++) {
      vec[i].first = ((vec[i - 1].first) * 10 + s[i] - '0') % a;
    }
    for (long long i = s.size() - 2; i >= 0; i--) {
      vec[i].second =
          (vec[i + 1].second + powerm(10, s.size() - 1 - i, b) * (s[i] - '0')) %
          b;
    }
    for (long long i = 0; i < s.size() - 1; i++) {
      if (vec[i].first == 0 && vec[i + 1].second == 0 && s[i + 1] != '0') {
        possible = true;
        ans = i;
        break;
      } else if (i == s.size() - 2) {
        possible = false;
      }
    }
  }
  if (possible) {
    cout << "YES\n";
    for (long long i = 0; i <= ans; i++) {
      cout << s[i];
    }
    cout << "\n";
    for (long long i = ans + 1; i < s.size(); i++) {
      cout << s[i];
    }
  } else {
    cout << "NO";
  }
  return 0;
}
