#include <bits/stdc++.h>
using namespace std;
long long mulMod(long long a, long long b, long long mod) {
  long long res = 0;
  while (b > 0) {
    if (b % 2 == 1) res = (res + a) % mod;
    a = (a + a) % mod;
    b /= 2;
  }
  return res;
}
long long powMod(long long base, long long exp, long long mod) {
  long long res = 1;
  while (exp > 0) {
    if (exp % 2 == 1) res = mulMod(res, base, mod);
    base = mulMod(base, base, mod);
    exp /= 2;
  }
  return res;
}
char s[1000010];
long long pref[1000010], post[1000010];
int main() {
  ios_base::sync_with_stdio(false);
  scanf("%s", s);
  long long a, b;
  scanf("%lld %lld", &a, &b);
  long long l = strlen(s);
  pref[0] = (s[0] - '0') % a;
  post[l - 1] = (s[l - 1] - '0') % b;
  long long i;
  for (i = 1; i < l; i++) {
    pref[i] = (pref[i - 1] * 10 + (s[i] - '0')) % a;
  }
  long long p = 10;
  for (i = l - 2; i >= 0; i--) {
    post[i] = (post[i + 1] + p * (s[i] - '0')) % b;
    p = (p * 10) % b;
  }
  long long flag = 0;
  for (i = 1; i <= l - 1; i++) {
    if (s[i] != '0' && pref[i - 1] == 0 && post[i] == 0) {
      flag = 1;
      break;
    }
  }
  if (flag == 1) {
    printf("YES\n");
    for (long long j = 0; j < i; j++) printf("%c", s[j]);
    printf("\n");
    for (long long j = i; j < l; j++) printf("%c", s[j]);
  } else
    printf("NO\n");
  return 0;
}
