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

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

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

class D:
    def __init__(self, txt: str):
        self.v: B = None
        self.u: A = None
        self.s: B = None
        self.txt = txt

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

c = A("c")
h = B("h")
e = C("e")
m = D("m")
a = E("a")
l = B("l")
j = C("j")
f = C("f")
g = E("g")

c.z = f
h.s = c
h.z = e
h.v = l
h.t = g
e.t = h
e.p = f
m.v = l
m.u = c
m.s = h
a.w = c
a.r = m
l.s = c
l.z = e
l.v = h
l.t = a
j.t = h
j.p = f
f.t = h
f.p = e
g.w = c
g.r = m
assert f.t.t.r.v.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.v: B = None
        self.u: A = None
        self.s: B = None
        self.txt = txt

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

c = A("c")
h = B("h")
e = C("e")
m = D("m")
a = E("a")
l = B("l")
j = C("j")
f = C("f")
g = E("g")

c.z = f
h.s = c
h.z = e
h.v = l
h.t = g
e.t = h
e.p = f
m.v = l
m.u = c
m.s = h
a.w = c
a.r = m
l.s = c
l.z = e
l.v = h
l.t = a
j.t = h
j.p = f
f.t = h
f.p = e
g.w = c
g.r = m
assert f.t.t.r.v.txt == "l"