#include using namespace std; #define FOR(i,a,b) for(int i=(a);i<(int)(b);i++) #define rep(i,n) FOR(i,0,n) #define ALL(x) (x).begin(),(x).end() int main() { string s, t; cin >> s >> t; sort(ALL(s)); bool f = false; do { if(s == t) f = true; } while (next_permutation(ALL(s))); puts(f ? "YES" : "NO"); return 0; }