class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: C = None
        self.u: D = None
        self.o: C = None
        self.q: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.z: C = None
        self.q: C = None
        self.t: C = None
        self.txt = txt

g = A("g")
j = B("j")
l = C("l")
e = D("e")
i = E("i")

g.y = e
j.s = l
j.o = l
j.u = e
j.q = i
l.o = j
e.z = g
i.z = l
i.q = l
i.t = l
assert g.y.z.y.z.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: C = None
        self.u: D = None
        self.o: C = None
        self.q: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.z: C = None
        self.q: C = None
        self.t: C = None
        self.txt = txt

g = A("g")
j = B("j")
l = C("l")
e = D("e")
i = E("i")

g.y = e
j.s = l
j.o = l
j.u = e
j.q = i
l.o = j
e.z = g
i.z = l
i.q = l
i.t = l
assert g.y.z.y.z.txt == "g"