//C++
//#pragma comment(linker, "/STACK:102400000,102400000")
//G++
//#define OPENSTACK
#define ONLINE_JUDGE
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cctype>
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int INF = 0x3f3f3f3f;
const double eps = 1e-8;
const int MOD = 998244353;
int n;
string get(int& len, string in){
int tag = in.find(".");
if(tag == in.npos) {
len = 0;
}else{
len = in.size() - tag - 1;
string a = in.substr(0, tag);
a += in.substr(tag + 1);
in = a;
}
return in;
}
string dealwith(string ans, int len){
int i;
for(i = 0; i < ans.size(); i ++){
if(ans[i] != '0') break;
}
// 找到第一不为0的点;
if(i == ans.size()) {
string a;
for(int i = 1; i <= n; i ++) a += '0';
return a + "*10^0";
}
else if(ans.size() - i >= n) {
//未超过ans
string a = ans.substr(i, n);
a += "*10^" + to_string((int)ans.size() - i - len);
return a;
}else{
//超过ans
string a = ans.substr(i, n);
for(int j = 1; j <= n - ans.size() + i; j ++) a += '0';
// 强转(int), 不然会溢出(对于ans.size()的类型).
a += "*10^" + to_string((int)ans.size() - i - len);
return a;
}
}
void print(string a){
// 之前没有搞清楚, 题目也没有说明对于0的输出规范, 这样的case真是难受.
// 之前一直以为只要输出0就可以了, 没想到还要输出后面的有效位数.
cout << "0." << a;
}
// 1546: 它们是否相等.
int main()
{
#ifdef OPENSTACK
int size = 64 << 20; // 64MB
char *p = (char*)malloc(size) + size;
#if (defined _WIN64) or (defined __unix)
__asm__("movq %0, %%rsp\n" :: "r"(p));
#else
__asm__("movl %0, %%esp\n" :: "r"(p));
#endif
#endif
#ifndef ONLINE_JUDGE
freopen("../put/a.input","r",stdin);
freopen("../put/a.output","w",stdout);
#endif
clock_t c1 = clock();
//coding here......
string a, b;
cin >> n >> a >> b;
// 第一遍做的时候一开始就陷入细节里面, 导致最后花的时间很长(写的code也不想全盘改)
int len = 0, len1 = 0;
// 处理小数点号:
a = get(len, a);
b = get(len1, b);
// 处理前缀零:
a = dealwith(a, len);
b = dealwith(b, len1);
if(a == b){
cout << "YES" << " ";
print(a);
}else{
cout << "NO" << " ";
print(a);
cout << " ";
print(b);
}
//finish here......
#ifndef ONLINE_JUDGE
std::cerr << "Time:" << clock() - c1 << "ms" << std::endl;
#endif
#ifdef OPENSTACK
exit(0);
#else
return 0;
#endif
}