How to Safely Opt Your Device Out of the Android Q Beta Program
The good news is that restoring your device to a stable version of Android 9 is actually quite easy. All it requires is a few button presses, then downloading and installing the update, and you’re done. The catch is that rolling back your device’s OS requires it to be reset to factory settings during the process, which wipes all your data and settings from the device. This is the opposite of upgrading to a new version of an OS, which keeps your files, apps, and other data largely intact.
Source: How to Safely Opt Your Device Out of the Android Q Beta Program