#include <bits/stdc++.h>
using namespace std;
string s, d;
long long n, a, b, i, j, z, k, m, p, dp[1000001];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  cin >> s >> a >> b;
  k = 0, p = 1;
  for (int i = s.size() - 1; i >= 0; i--) {
    k = k + (s[i] - '0') * p;
    p = p * 10;
    k = k % b;
    p = p % b;
    if (k == 0) {
      dp[i] = 1;
    }
  }
  k = 0;
  for (int i = 0; i < s.size(); i++) {
    k = k * 10 + (s[i] - '0');
    k = k % a;
    d += s[i];
    if (k == 0 && dp[i + 1] == 1 && s[i + 1] != '0') {
      cout << "YES" << '\n';
      string t = "";
      for (int j = i + 1; j < s.size(); j++) {
        t += s[j];
      }
      cout << d << '\n' << t;
      return 0;
    }
  }
  cout << "NO";
  return 0;
}
