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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: B = None
        self.o: B = None
        self.r: D = None
        self.y: C = None
        self.q: C = None
        self.txt = txt

c = A("c")
i = B("i")
a = C("a")
l = D("l")
h = E("h")

c.t = i
c.p = a
c.v = l
i.o = h
a.z = i
l.x = i
h.w = i
h.o = i
h.r = l
h.y = a
h.q = a
assert a.z.o.r.x.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.p: C = None
        self.v: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: B = None
        self.o: B = None
        self.r: D = None
        self.y: C = None
        self.q: C = None
        self.txt = txt

c = A("c")
i = B("i")
a = C("a")
l = D("l")
h = E("h")

c.t = i
c.p = a
c.v = l
i.o = h
a.z = i
l.x = i
h.w = i
h.o = i
h.r = l
h.y = a
h.q = a
assert a.z.o.r.x.txt == "i"