#include <bits/stdc++.h>
int number[1000000];
char awork[1000000];
int main() {
  int i, j, a, b, len, ch, moda, modb, pow;
  moda = modb = len = 0;
  while (isdigit(ch = fgetc(stdin))) {
    number[len] = ch - '0';
    len++;
  }
  scanf("%d %d\n", &a, &b);
  moda = 0;
  for (i = 0; i < len; i++) {
    moda *= 10;
    moda += number[i];
    moda %= a;
    awork[i] = (moda == 0);
  }
  pow = 1;
  for (i = len - 1; i > 0; i--) {
    modb += pow * number[i];
    modb %= b;
    if (modb == 0 && awork[i - 1] && number[i]) break;
    pow *= 10;
    pow %= b;
  }
  if (i) {
    printf("YES\n");
    for (j = 0; j < len; j++) {
      printf("%d", number[j]);
      if (j == i - 1 || j == len - 1) printf("\n");
    }
  } else
    printf("NO\n");
}
