I followed the advice of one of the posters to enable Yahoo Account Key and download Yahoo Mail app. Even though they don't call it a Two-Step Verification, in fact, it is exactly that. Now to get a web access to Yahoo mail I have to type in a code sent by SMS or by a pop-up from Yahoo mail app. I have also enabled the Allow apps that use less secure sign in option.
After that, I deleted Yahoo mail on both my iPhone and iPad and re-created them using built-in Yahoo as a provider. Everything started working at first. Later I turned off the use of Yahoo Account Key so now I can log into Yahoo mail within a browser using my original password. Yahoo mail continued working on my iPhone and iPad but later I ran into problems on iPad.
Yahoo mail does not download on iPad! Today (Thursday) I checked my Inbox only to find out the latest emails shown date back to Monday. I don't know why Yahoo does not work on iPad the way it does on iPhone. Later today I managed to force Yahoo to download on iPad but it took a lot of effort. The bottom line is the above method does not reliably work on iPad.