import std.algorithm, std.array, std.container, std.range, std.bitmanip; import std.numeric, std.math, std.bigint, std.random; import std.string, std.conv, std.stdio, std.typecons; void main() { auto s1 = readln.chomp; auto n = readln.chomp.to!long; auto s2 = readln.chomp; writeln(calc(s1, s2, n) ? "SUCCESS" : "FAILURE"); } bool calc(string s1, string s2, long n) { if (s1.count('o') != s2.count('o')) return true; if (s1.count('o') == 0 || s1.count('o') == 3) return false; if (n == 0) { return s1 != s2; } else if (n >= 2) { return false; } int p1, p2; if (s1.count('o') == 1) { p1 = s1.countUntil('o').to!int; p2 = s2.countUntil('o').to!int; } else { p1 = s1.countUntil('x').to!int; p2 = s2.countUntil('x').to!int; } if (p1 == 1) { return p2 == 1; } else { return p1 != p2 && p2 != 1; } }