#include <bits/stdc++.h>
char s[1 << 20];
int n, a, b, v[1 << 20], p, t;
int main() {
  gets(s);
  n = strlen(s);
  scanf("%d%d", &a, &b);
  p = 1 % b;
  for (int i = 0; i < n; ++i)
    v[n - 1 - i] = (v[n - i] + (s[n - 1 - i] - '0') * p) % b, p = p * 10 % b;
  if ('0' != *s)
    for (int i = 1; i < n; ++i) {
      t = (t * 10 + s[i - 1] - '0') % a;
      if ('0' != s[i] && !t && !v[i]) {
        puts("YES");
        printf("%.*s\n%s\n", i, s, s + i);
        return 0;
      }
    }
  puts("NO");
}
