Rules do not allow writing to the Database

Guys, I use Firebase Authentication and I set these rules for user registration, but when entering the registration screen the message appears: “FirebaseError - Permission denied”. When I press continue it records but it repeats the UID twice
There is a problem with these rules:

App - Registration

Realtime Database:

You are setting it in the Project Bucket and then in the store value tag

I did as you said, leaving only the uid in the project bucket:

When opening to register the firebase message continues to appear. Is there any error in this rule?

How do I edit records?

but what about these uid variables?