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

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

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

class D:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

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

e.q = i
e.p = i
e.w = j
j.o = i
i.u = e
h.u = j
assert h.u.o.u.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.p: C = None
        self.w: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

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

e.q = i
e.p = i
e.w = j
j.o = i
i.u = e
h.u = j
assert h.u.o.u.txt == "e"