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

class B:
    def __init__(self, txt: str):
        self.q: A = None
        self.s: A = None
        self.y: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.t: F = None
        self.u: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.z: F = None
        self.w: F = None
        self.t: B = None
        self.q: C = None
        self.o: F = None
        self.y: C = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.q: A = None
        self.s: A = None
        self.y: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.t: F = None
        self.u: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.z: F = None
        self.w: F = None
        self.t: B = None
        self.q: C = None
        self.o: F = None
        self.y: C = None
        self.txt = txt

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

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

g.w = j
i.q = g
i.s = g
i.y = c
d.w = i
d.t = c
d.u = c
j.q = h
j.y = h
j.o = h
h.z = c
h.w = c
h.o = c
h.t = i
h.q = m
h.y = m
c.u = g
m.w = i
m.t = c
m.u = c
assert m.u.u.w.q.txt == "h"