#include <bits/stdc++.h>
using namespace std;
long long int power(long long int a, long long int b, long long int m) {
  long long int ans = 1;
  while (b) {
    if (b & 1) {
      ans = ((ans % m) * (a % m)) % m;
    }
    a = ((a % m) * (a % m)) % m;
    b = b >> 1;
  }
  return ans;
}
long long int powe(long long int a, long long int b) {
  long long int ans = 1;
  while (b) {
    if (b & 1) {
      ans = a * ans;
    }
    a = a * a;
    b = b >> 1;
  }
  return ans;
}
long long int ncr(long long int n, long long int r) {
  r = ((r < n - r) ? (r) : (n - r));
  long long int ans = 1;
  for (int i = 0; i < r; i++) {
    ans *= (n - i);
    ans /= (i + 1);
  }
  return ans;
}
void solve() {
  string s;
  cin >> s;
  long long int n = s.length();
  long long int a, b;
  cin >> a >> b;
  vector<long long int> left(n + 1, 0), right(n + 2, 0);
  for (int i = 0; i < n; i++) {
    long long int temp = left[i] % a;
    temp = (temp % a) * (10 % a);
    temp = temp % a;
    left[i + 1] = (temp + (s[i] - '0')) % a;
  }
  for (int i = n - 1; i >= 0; i--) {
    long long int temp;
    temp = (s[i] - '0') * power(10, n - 1 - i, b);
    temp = temp % b;
    right[i + 1] = (right[i + 2] % b + temp) % b;
  }
  long long int breaking = -1;
  for (int i = 1; i <= n - 1; i++) {
    if (left[i] == 0 && right[i + 1] == 0 && s[i] != '0') {
      breaking = i;
      break;
    }
  }
  if (breaking == -1) {
    cout << "NO" << endl;
    return;
  }
  cout << "YES\n";
  cout << s.substr(0, breaking) << "\n" << s.substr(breaking) << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int t = 1;
  while (t > 0) {
    solve();
    t--;
  }
}
