#include <bits/stdc++.h>
using namespace std;
int main() {
  char s[1000001];
  int ra[1000001];
  int a, b;
  int len;
  scanf("%s", s);
  scanf("%d%d", &a, &b);
  int ia, ib;
  int rb, mb;
  if (s[0] == '0')
    printf("NO");
  else {
    ra[0] = (s[0] - '0') % a;
    for (len = 1; s[len] != '\0'; ++len) {
      ra[len] = (ra[len - 1] * 10 + s[len] - '0') % a;
    }
    mb = 1;
    rb = 0;
    for (int i = len - 1; i > 0; --i) {
      rb = (rb + (s[i] - '0') * mb) % b;
      if ((rb == 0) && (ra[i - 1] == 0) && (s[i] != '0')) {
        printf("YES\n");
        char tmp = s[i];
        s[i] = '\0';
        printf("%s\n", s);
        s[i] = tmp;
        printf("%s", s + i);
        return 0;
      }
      mb = mb * 10 % b;
    }
    printf("NO");
  }
  return 0;
}
