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

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.p: A = None
        self.txt = txt

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

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

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

d = A("d")
i = B("i")
k = C("k")
g = D("g")
a = E("a")

d.o = k
d.t = i
d.q = i
i.t = a
i.p = d
k.u = i
g.r = i
g.t = i
a.z = i
a.x = i
a.q = k
a.y = k
assert i.p.o.u.t.q.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.t: B = None
        self.q: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.p: A = None
        self.txt = txt

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

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

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

d = A("d")
i = B("i")
k = C("k")
g = D("g")
a = E("a")

d.o = k
d.t = i
d.q = i
i.t = a
i.p = d
k.u = i
g.r = i
g.t = i
a.z = i
a.x = i
a.q = k
a.y = k
assert i.p.o.u.t.q.txt == "k"