#include <bits/stdc++.h>
using namespace std;
char key[1000010];
int lrem[1000010], rrem[1000010];
int a, b;
int main() {
  scanf("%s", key);
  scanf("%d %d", &a, &b);
  int len = strlen(key);
  int i;
  int t1 = 0, t2 = 0;
  int P = 1;
  for (i = 0; i < len; i++) {
    t1 = (t1 * 10 + key[i] - '0') % a;
    lrem[i] = t1;
    t2 = ((key[len - i - 1] - '0') * P + t2) % b;
    P = (P * 10) % b;
    rrem[len - i - 1] = t2;
  }
  int leftlen = len;
  for (i = 0; i < len; i++)
    if (lrem[i] == 0 && rrem[i + 1] == 0) {
      while (!(key[i + 1] - '0')) i++;
      leftlen = i;
      break;
    }
  if (leftlen >= len - 1)
    printf("NO\n");
  else {
    printf("YES\n");
    for (i = 0; i <= leftlen; i++) putchar(key[i]);
    putchar('\n');
    for (; i < len; i++) putchar(key[i]);
    putchar('\n');
  }
  return 0;
}
