#include <bits/stdc++.h>
using namespace std;
long long int rem[1000005], p = 1;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  string s;
  cin >> s;
  long long int a, b;
  cin >> a >> b;
  for (int i = s.length() - 1; i >= 0; --i) {
    rem[i] = ((s[i] - '0') * p + rem[i + 1]) % b;
    p = p * 10 % b;
  }
  p = 0;
  for (int i = 0; i < s.length(); ++i) {
    p = (p * 10 + (s[i] - '0')) % a;
    if (s[i + 1] != '0' && p == 0 && rem[i + 1] == 0) {
      if (i != s.length() - 1) {
        cout << "YES"
             << "\n";
        cout << s.substr(0, i + 1) << "\n";
        cout << s.substr(i + 1) << "\n";
        return 0;
      }
    }
  }
  cout << "NO"
       << "\n";
  return 0;
}
