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