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

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

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

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

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

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

m.u = l
b.v = m
b.q = l
e.r = m
e.t = f
e.s = b
e.x = l
e.w = j
l.v = j
l.z = f
c.z = j
f.r = j
f.w = j
f.t = e
f.s = h
f.x = l
j.u = l
n.z = m
h.v = m
h.q = l
assert c.z.u.z.s.v.u.v.u.v.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

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

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

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

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

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

m.u = l
b.v = m
b.q = l
e.r = m
e.t = f
e.s = b
e.x = l
e.w = j
l.v = j
l.z = f
c.z = j
f.r = j
f.w = j
f.t = e
f.s = h
f.x = l
j.u = l
n.z = m
h.v = m
h.q = l
assert c.z.u.z.s.v.u.v.u.v.txt == "j"