#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 10;
const long long int INF = 2e18 + 10;
const int Mod = 1e9 + 7;
const int MAXN = 1e6 + 10;
const int N = 5e5 + 10;
const int M = 1e3 + 10;
string s;
int a, b, pre[MAXN], suf[MAXN];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> s >> a >> b;
  pre[0] = (s[0] - '0') % a;
  for (int i = 1; i < s.size(); i++) {
    pre[i] = (10 * pre[i - 1] + (s[i] - '0')) % a;
  }
  suf[s.size() - 1] = (s[s.size() - 1] - '0') % b;
  int p10 = 10;
  for (int i = s.size() - 2; i >= 0; i--) {
    suf[i] = (suf[i + 1] + p10 * (s[i] - '0')) % b;
    p10 = (p10 * 10) % b;
  }
  for (int i = 0; i < (s.size() - 1); i++) {
    if (suf[i + 1] >= 0) {
      if (suf[i + 1] == 0 && pre[i] == 0 && s[i + 1] != '0') {
        cout << "YES" << endl;
        cout << s.substr(0, i + 1) << endl;
        cout << s.substr(i + 1, s.size() - i - 1) << endl;
        return 0;
      }
    } else
      continue;
  }
  cout << "NO" << endl;
  return 0;
}
