#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s;
  cin >> s;
  long long a, b;
  cin >> a >> b;
  vector<long long> pre, suf;
  long long val = 0;
  for (int i = 0; i < s.size(); i++) {
    val *= 10;
    val += (s[i] - '0');
    val %= a;
    pre.push_back(val);
  }
  val = 0;
  long long mul = 1;
  for (int i = s.size() - 1; i >= 0; i--) {
    val = ((s[i] - '0') * mul) + val;
    val %= b;
    mul = (mul * 10) % b;
    suf.push_back(val);
  }
  string ans, ans_;
  long long j = s.size() - 2;
  for (int i = 0; i < s.size() - 1; i++) {
    ans += s[i];
    if (pre[i] == 0 && suf[j] == 0 && s[i + 1] != '0') {
      cout << "YES\n";
      cout << ans << "\n";
      for (int j = i + 1; j < s.size(); j++) ans_ += s[j];
      cout << ans_;
      return 0;
    }
    j--;
  }
  cout << "NO";
  return 0;
}
