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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: C = None
        self.z: C = None
        self.x: D = None
        self.t: E = None
        self.p: A = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: C = None
        self.z: C = None
        self.x: D = None
        self.t: E = None
        self.p: A = None
        self.txt = txt

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

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