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

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.t: E = None
        self.v: C = None
        self.z: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.r: A = None
        self.w: A = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.t: E = None
        self.v: C = None
        self.z: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.r: A = None
        self.w: A = None
        self.txt = txt

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

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

m.t = b
k.y = m
k.t = e
k.v = b
k.z = b
b.p = m
b.z = d
b.t = c
b.v = k
l.r = m
l.w = m
f.u = k
f.t = e
f.y = m
i.r = m
i.w = m
g.u = k
g.t = e
g.y = m
d.p = m
d.z = b
d.t = i
d.v = k
c.r = m
c.w = m
e.u = k
e.t = f
e.y = m
assert f.y.t.t.r.txt == "m"