#include <bits/stdc++.h>
using namespace std;
const int mod = (int)1e9 + 7;
const int N_ = (int)2e6 + 2;
long long n, a, b, mid;
char s[N_];
long long L[N_], R[N_];
long long pre[N_];
int main() {
  scanf("%s", s);
  scanf("%lld %lld", &a, &b);
  n = strlen(s);
  pre[0] = 1;
  for (int i = 1; i <= n; i++) {
    pre[i] = (pre[i - 1] * 10) % b;
    L[i] = (L[i - 1] * 10 + (long long)(s[i - 1] - '0')) % a;
  }
  for (int i = n; i >= 1; --i) {
    R[i] = (R[i + 1] + (long long)(s[i - 1] - '0') * pre[n - i]) % b;
  }
  for (int i = 1; i < n; i++) {
    if (s[i] == '0') continue;
    if (L[i] == 0 && R[i + 1] == 0) {
      mid = i;
      printf("YES\n");
      for (int i = 0; i < mid; i++) printf("%c", s[i]);
      printf("\n");
      for (int i = mid; i < n; i++) printf("%c", s[i]);
      printf("\n");
      return 0;
    }
  }
  printf("NO");
  return 0;
}
