#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T mod_v(T num, T m) {
  if (num >= 0)
    return num % m;
  else
    return (num % m + m) % m;
}
template <class T>
T fast_pow(T n, T p, T m) {
  if (p == 0) return 1;
  if (p % 2) {
    T g = mod_v(mod_v(n, m) * mod_v(fast_pow(n, p - 1, m), m), m);
    return g;
  } else {
    T g = fast_pow(n, p / 2, m);
    g = mod_v(mod_v(g, m) * mod_v(g, m), m);
    return g;
  }
}
template <class T>
inline void debug(string S1, T S2, string S3) {
  cout << S1 << S2 << S3;
}
template <class T>
inline T in() {
  register char c = 0;
  register T num = 0;
  bool n = false;
  while (c < 33) c = getchar();
  while (c > 33) {
    if (c == '-')
      n = true;
    else
      num = num * 10 + c - '0';
    c = getchar();
  }
  return n ? -num : num;
}
bool mark[1000009];
string s;
int main() {
  cin >> s;
  long long a, b;
  a = in<long long>();
  b = in<long long>();
  memset(mark, false, sizeof(mark));
  ;
  long long num = 0;
  for (int i = 0; i < ((int)s.size()); i++) {
    num = (num * 10 + (s[i] - 48)) % a;
    if (!num) mark[i] = true;
  }
  num = 0;
  int pos = -1;
  long long j = 0;
  for (int i = ((int)s.size()) - 1; i > 0; i--, j++) {
    num = ((((long long)(s[i] - 48) % b *
             (fast_pow((long long)10, j, (long long)b) % b)) %
                b +
            num) %
           b) %
          b;
    if (num == 0 && mark[i - 1] == true && s[i] > '0') {
      pos = i;
      break;
    }
  }
  if (pos > -1) {
    printf("YES\n");
    for (int i = 0; i < pos; i++) printf("%c", s[i]);
    printf("\n");
    for (int i = pos; i < ((int)s.size()); i++) printf("%c", s[i]);
  } else
    printf("NO\n");
  return 0;
}
