#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  long long a, b;
  cin >> a >> b;
  pair<long long, long long> n[s.length()];
  int mult = 10;
  for (int i = s.length() - 1; i >= 1; i--) {
    if (i == s.length() - 1) {
      n[i].second = (s[i] - 48) % b;
    } else {
      n[i].second = ((s[i] - 48) * mult + n[i + 1].second) % b;
      mult = (mult * 10) % b;
    }
  }
  mult = 10;
  for (int i = 0; i < s.length() - 1; i++) {
    if (i == 0) {
      n[i].first = (s[i] - 48) % a;
    } else {
      n[i].first = (n[i - 1].first * mult + (s[i] - 48)) % a;
    }
  }
  for (int i = 0; i < s.length() - 1; i++) {
    if (n[i].first == 0 && s[i + 1] != '0' && n[i + 1].second == 0) {
      cout << "YES" << '\n';
      for (int j = 0; j <= i; j++) {
        cout << s[j];
      }
      cout << '\n';
      for (int j = i + 1; j < s.length(); j++) {
        cout << s[j];
      }
      return 0;
    }
  }
  cout << "NO";
  return 0;
}
