class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.u: F = None
        self.t: C = None
        self.r: F = None
        self.q: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: A = None
        self.p: E = None
        self.txt = txt

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

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

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

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

g = A("g")
m = B("m")
e = C("e")
b = D("b")
c = E("c")
i = F("i")
a = B("a")
h = E("h")

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

class B:
    def __init__(self, txt: str):
        self.o: A = None
        self.p: E = None
        self.txt = txt

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

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

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

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

g = A("g")
m = B("m")
e = C("e")
b = D("b")
c = E("c")
i = F("i")
a = B("a")
h = E("h")

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