#include <bits/stdc++.h>
using namespace std;
char ch[1000009];
long long int lft, rgt;
long long int a, b;
int len;
int arr[1000009];
int aarr[1000009];
int main() {
  scanf("%s", ch);
  cin >> a >> b;
  len = strlen(ch);
  long long int pw = 1;
  for (int i = 0; i < len; i++) {
    ch[i] -= '0';
  }
  rgt = 0;
  lft = 0;
  for (int i = 0, j = len - 1; i < len; i++, j--) {
    rgt += pw * (long long int)ch[j];
    lft = (long long int)ch[i] + 10 * lft;
    pw *= 10;
    pw %= b;
    rgt %= b;
    lft %= a;
    if (rgt == 0) arr[j] = 1;
    if (lft == 0) aarr[i] = 1;
  }
  long long int pwl = 1;
  long long int pwr = 1;
  lft = 0;
  for (int i = 1; i < len; i++) {
    pwr *= 10;
  }
  for (int i = 1; i < len; i++) {
    if (ch[i] != 0) {
      if (aarr[i - 1] && arr[i]) {
        cout << "YES" << endl;
        for (int j = 0; j < i; j++) printf("%d", (int)ch[j]);
        cout << endl;
        for (int j = i; j < len; j++) printf("%d", (int)ch[j]);
        cout << endl;
        return 0;
      }
    }
  }
  cout << "NO" << endl;
  return 0;
}
