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

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

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

class D:
    def __init__(self, txt: str):
        self.s: E = None
        self.t: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.v: B = None
        self.txt = txt

g = A("g")
h = B("h")
l = C("l")
m = D("m")
d = E("d")
c = A("c")
b = C("b")
j = A("j")

g.s = h
g.o = m
g.z = j
g.t = j
g.q = l
h.u = g
h.x = g
h.q = j
l.z = h
l.p = b
m.s = d
m.t = l
d.r = h
d.v = h
c.s = h
c.o = m
c.z = j
c.q = l
c.t = g
b.z = h
b.p = l
j.s = h
j.o = m
j.z = g
j.q = l
j.t = c
assert m.s.r.q.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.o: D = None
        self.z: A = None
        self.q: C = None
        self.t: A = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.s: E = None
        self.t: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.v: B = None
        self.txt = txt

g = A("g")
h = B("h")
l = C("l")
m = D("m")
d = E("d")
c = A("c")
b = C("b")
j = A("j")

g.s = h
g.o = m
g.z = j
g.t = j
g.q = l
h.u = g
h.x = g
h.q = j
l.z = h
l.p = b
m.s = d
m.t = l
d.r = h
d.v = h
c.s = h
c.o = m
c.z = j
c.q = l
c.t = g
b.z = h
b.p = l
j.s = h
j.o = m
j.z = g
j.q = l
j.t = c
assert m.s.r.q.z.z.txt == "j"