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

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

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.r: E = None
        self.o: D = None
        self.w: D = None
        self.x: D = None
        self.txt = txt

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

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

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

a.w = g
a.t = g
d.z = g
d.r = g
d.w = f
d.q = j
c.t = j
c.x = j
c.r = g
c.o = f
c.w = f
m.u = f
g.w = d
h.t = f
h.x = f
h.r = g
h.o = j
h.w = j
j.u = m
f.u = m
k.w = g
k.t = g
assert g.w.w.u.u.u.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.t: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.r: E = None
        self.o: D = None
        self.w: D = None
        self.x: D = None
        self.txt = txt

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

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

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

a.w = g
a.t = g
d.z = g
d.r = g
d.w = f
d.q = j
c.t = j
c.x = j
c.r = g
c.o = f
c.w = f
m.u = f
g.w = d
h.t = f
h.x = f
h.r = g
h.o = j
h.w = j
j.u = m
f.u = m
k.w = g
k.t = g
assert g.w.w.u.u.u.u.u.u.u.txt == "m"