List all installed packages that are not dependencies of any other installed packages

I would like to list all installed DNF packages that are not dependencies of any other installed packages. How can I accomplish this?

Nevermind, installing dnf-command(leaves) and running dnf leaves worked for me.

sudo dnf repoquery --userinstalled will list the packages that marked as installed by the user.