#include <bits/stdc++.h>
using namespace std;
char num[1000001];
long long a, b;
bool divA[1000001], divB[1000001];
int main() {
  scanf("%s%lld%lld", num, &a, &b);
  long long x = 0, n = strlen(num), base = 1;
  for (int i = 0; i < n; i++) {
    x = (x * 10 + (num[i] - '0')) % a;
    divA[i] = (x == 0);
  }
  x = 0;
  for (int i = n - 1; i >= 0; i--) {
    x += (((num[i] - '0') % b * base) % b);
    x %= b;
    divB[i] = (x == 0);
    base *= 10;
    base %= b;
  }
  for (int i = 0; i < n - 1; i++) {
    if (divA[i] && divB[i + 1] && num[i + 1] != '0') {
      puts("YES");
      for (int j = 0; j <= i; j++) printf("%c", num[j]);
      printf("\n");
      for (int j = i + 1; j < n; j++) printf("%c", num[j]);
      return 0;
    }
  }
  puts("NO");
}
