#include <bits/stdc++.h>
using namespace std;
long long x[1000005];
long long fwd[1000005];
long long rev[1000005];
int main() {
  long long a, b;
  long long y = 1;
  string s;
  cin >> s;
  cin >> a >> b;
  int len = s.length();
  int cnt = 0;
  int n = len;
  while (len--) {
    x[cnt] = y;
    y = (y * 10) % b;
    cnt++;
  }
  len = s.length();
  rev[n] = 0;
  for (int i = 0; i < n; i++) rev[i] = -1;
  for (int i = n - 1; i >= 0; i--) {
    if (s[i] == '0') {
      rev[i] = rev[i + 1];
      continue;
    }
    rev[i] = (rev[i + 1] + ((s[i] - '0') * x[n - i - 1]) % b) % b;
  }
  fwd[0] = (s[0] - '0') % a;
  for (int i = 1; i < n; i++) {
    fwd[i] = (fwd[i - 1] * 10 + s[i] - '0') % a;
  }
  for (int i = 0; i < n - 1; i++) {
    if (fwd[i] == 0 && rev[i + 1] == 0 && s[i + 1] != '0') {
      cout << "YES" << endl;
      for (int j = 0; j <= i; j++) cout << s[j];
      cout << endl;
      for (int j = i + 1; j < n; j++) cout << s[j];
      cout << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
  return 0;
}
