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

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

class C:
    def __init__(self, txt: str):
        self.x: E = None
        self.r: D = None
        self.u: E = None
        self.y: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.p: D = None
        self.z: B = None
        self.y: E = None
        self.q: D = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.x: E = None
        self.r: D = None
        self.u: E = None
        self.y: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.p: D = None
        self.z: B = None
        self.y: E = None
        self.q: D = None
        self.txt = txt

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

d.t = c
d.x = b
d.q = m
h.u = d
j.x = g
j.r = f
j.u = a
j.y = h
i.w = g
i.o = c
i.s = c
i.x = b
a.p = f
a.q = f
a.z = h
a.y = g
g.p = f
g.z = h
g.y = a
g.q = i
f.w = a
f.o = c
f.s = d
f.x = b
m.x = a
m.r = f
m.u = g
m.y = h
b.w = a
b.o = d
b.s = d
b.x = f
c.t = d
c.x = b
c.q = m
assert d.x.w.y.z.u.t.q.u.txt == "g"