#include <bits/stdc++.h>
using namespace std;
int A[1000005], B[1000005];
int main() {
  long long a, b, i, j, k, len;
  string s;
  cin >> s;
  cin >> a >> b;
  len = s.size();
  A[0] = (s[0] - '0') % a;
  for (i = 1; i < len; i++) {
    A[i] = (((A[i - 1]) * 10) % a + (s[i] - '0')) % a;
  }
  k = 10;
  B[len - 1] = (s[len - 1] - '0') % b;
  for (i = len - 2; i >= 0; i--) {
    B[i] = (((s[i] - '0') * k) % b + B[i + 1]) % b;
    k = (k * 10) % b;
  }
  k = -5;
  for (i = 1; i < len; i++) {
    if (A[i - 1] == 0 && B[i] == 0 && s[i] != '0') {
      k = i;
      break;
    }
  }
  if (k >= 0) {
    cout << "YES" << endl;
    for (i = 0; i < k; i++) cout << s[i];
    cout << endl;
    for (i = k; i < len; i++) cout << s[i];
    cout << endl;
  } else
    cout << "NO" << endl;
  return 0;
}
