def main():
	from sys import stdin, stdout
	n = int(stdin.readline().rstrip())
	s = stdin.readline().rstrip()
	
	flag = True
	for i in range(n - 1):
		if s[i] <= s[i + 1]:
			continue
		else:
			flag = False
	
	if flag == True:
		stdout.write("NO\n")
		return
			
	for i in range(n):
		for j in range(i + 1, n):
			sr = s[i:j][::-1]
			if sr < s[i:j]:
				stdout.write(sr + "\n" + s[i:j] + "\n")
				stdout.write("YES\n" + str(i + 1) + " " + str(j) + "\n")
				return
	
	
if __name__ == "__main__":
	main()
