In ancient Egypt, the head of government was Pharaoh.
The ancient Egyptians said "Pharaoh", not the pharaoh. That's because there was only one pharaoh at a time, and Pharaoh owned everything. You did not own your home or your jewelry or your food or anything else. Pharaoh owned everything.
Each pharaoh had an army, a police force, and a huge number of ministers and government officials to help him rule the country. The most important of these helpers was Pharaoh's right hand man, his Vizier.
The Vizier received reports from every top official every day. Every day, the Vizier gave Pharaoh a concise report on what was happening all over Egypt.
The ancient Egyptian legal system was based on common sense. The Egyptian goddess Ma'at was the goddess of justice. Basically, the law followed the teachings of Ma'at, according to the priests, about what was right and wrong. No remains of written laws have been found. However, since the ancient Egyptians loved lists and wrote everything down they could, it it would not surprise historians to learn they did write down (codify) some laws at least. Were the laws fair to all people? Probably.
The ancient Egyptians did have a court system. When a dispute was settled in court, both sides were heard, and a common sense decision was made by the lower court based on the facts presented. However, if you did not like the decision of the lower court, you could come before the Vizier on a first come, first served basis, and present your case again. It was not smart to come before the Vizier unless your case was serious, and you had evidence to show that the lower court's decision was in error because the Vizier's decision was final. You could end up in more trouble than you were in already by demanding to have your case heard in the high court. But the Vizier did try to be fair.