#include <bits/stdc++.h>
using namespace std;
int x[2000006];
int main() {
  string s;
  int i, ans = 0, ct = 1, ok = 0, sum = 0, a, b, c = 0, ln;
  cin >> s >> a >> b;
  ln = s.length();
  for (i = ln - 1; i >= 0; i--) {
    sum = (((s[i] - '0') * ct) + sum) % b;
    ct = (ct * 10) % b;
    x[i] = sum;
  }
  x[ln] = -1;
  for (i = 0; i < ln; i++) {
    ans = ((ans * 10) + (s[i] - '0')) % a;
    if (ans == 0 && (x[i + 1] == 0 && s[i + 1] != '0')) {
      cout << "YES\n"
           << s.substr(0, i + 1) << "\n"
           << s.substr(i + 1, ln - i - 1);
      return 0;
    }
  }
  cout << "NO\n";
}
