#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000010;
char str[maxn];
long long num1[maxn];
long long num2[maxn];
void judge(long long a, long long b) {
  long long ansa = 0, ansb = 0, d = 1, len = strlen(str), mod;
  for (long long i = 0; i < len; ++i) {
    ansb = ansb + (str[len - i - 1] - '0') * d;
    d = d * 10 % b;
    ansa = ansa * 10 + (str[i] - '0');
    ansa = ansa % a;
    ansb = ansb % b;
    num1[i] = ansa;
    num2[len - i - 1] = ansb;
  }
}
int main() {
  long long t, i, j, k, l, a, b;
  scanf("%s", str);
  long long len = strlen(str);
  scanf("%lld%lld", &a, &b);
  judge(a, b);
  for (i = 0; i < len - 1; ++i) {
    if (num1[i] == 0 && (str[i + 1] != '0') && (num2[i + 1] == 0)) break;
  }
  if (i >= len - 1) {
    printf("NO\n");
  } else {
    printf("YES\n");
    for (j = 0; j < len; ++j) {
      if (j == i + 1) printf("\n");
      printf("%c", str[j]);
    }
    printf("\n");
  }
  return 0;
}
