#include <bits/stdc++.h>
using namespace std;
char num[2000000];
int pot10[2000000];
int main() {
  scanf("%s", num);
  int a, b;
  scanf("%d%d", &a, &b);
  int n = strlen(num);
  int moda = 0, modb = 0;
  pot10[n - 1] = 1;
  for (int i = n - 2; i >= 0; i--) {
    pot10[i] = (pot10[i + 1] * 10) % b;
  }
  for (int i = 0; i < n; i++) modb = (modb * 10 + num[i] - '0') % b;
  for (int i = 0; i < n - 1; i++) {
    moda = (moda * 10 + num[i] - '0') % a;
    modb = (modb - (pot10[i] * (num[i] - '0')) % b + b + b) % b;
    if (num[i + 1] != '0' && moda == modb && moda == 0) {
      char c = num[i + 1];
      num[i + 1] = 0;
      printf("YES\n%s\n", num);
      num[i + 1] = c;
      printf("%s\n", num + i + 1);
      return 0;
    }
  }
  puts("NO");
}
