class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: C = None
        self.o: C = None
        self.s: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: B = None
        self.r: B = None
        self.o: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: A = None
        self.o: B = None
        self.w: B = None
        self.txt = txt

e = A("e")
i = B("i")
a = C("a")
h = D("h")

e.z = a
i.t = a
i.o = a
i.s = a
a.q = i
a.r = i
a.o = e
h.r = e
h.o = i
h.w = i
assert i.t.o.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: C = None
        self.o: C = None
        self.s: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: B = None
        self.r: B = None
        self.o: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: A = None
        self.o: B = None
        self.w: B = None
        self.txt = txt

e = A("e")
i = B("i")
a = C("a")
h = D("h")

e.z = a
i.t = a
i.o = a
i.s = a
a.q = i
a.r = i
a.o = e
h.r = e
h.o = i
h.w = i
assert i.t.o.z.txt == "a"