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

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

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

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

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

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

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

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

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

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

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

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

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