class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.v: D = None
        self.txt = txt

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

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

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

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

f = A("f")
g = B("g")
b = C("b")
i = D("i")
h = E("h")
d = E("d")
l = E("l")
c = C("c")
e = E("e")

f.q = e
f.v = i
g.y = c
b.r = c
b.t = h
i.t = g
i.q = g
i.r = g
i.z = d
h.x = e
h.w = c
d.x = e
d.w = c
l.x = h
l.w = c
c.r = b
c.t = h
e.x = d
e.w = c
assert g.y.t.x.x.w.t.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.v: D = None
        self.txt = txt

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

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

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

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

f = A("f")
g = B("g")
b = C("b")
i = D("i")
h = E("h")
d = E("d")
l = E("l")
c = C("c")
e = E("e")

f.q = e
f.v = i
g.y = c
b.r = c
b.t = h
i.t = g
i.q = g
i.r = g
i.z = d
h.x = e
h.w = c
d.x = e
d.w = c
l.x = h
l.w = c
c.r = b
c.t = h
e.x = d
e.w = c
assert g.y.t.x.x.w.t.txt == "h"