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

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

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

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

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

i = A("i")
d = B("d")
l = C("l")
k = D("k")
c = E("c")

i.z = d
i.x = d
i.y = k
d.x = c
l.p = k
l.z = c
l.x = d
l.y = d
k.o = d
c.t = d
assert k.o.x.t.x.t.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.y: D = None
        self.x: B = None
        self.txt = txt

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

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

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

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

i = A("i")
d = B("d")
l = C("l")
k = D("k")
c = E("c")

i.z = d
i.x = d
i.y = k
d.x = c
l.p = k
l.z = c
l.x = d
l.y = d
k.o = d
c.t = d
assert k.o.x.t.x.t.txt == "d"