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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.t: C = None
        self.p: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.v: C = None
        self.u: A = None
        self.o: A = None
        self.p: B = None
        self.r: E = None
        self.t: E = None
        self.txt = txt

m = A("m")
b = B("b")
a = C("a")
k = D("k")
c = E("c")
d = F("d")
n = G("n")
g = H("g")

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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.t: C = None
        self.p: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.v: C = None
        self.u: A = None
        self.o: A = None
        self.p: B = None
        self.r: E = None
        self.t: E = None
        self.txt = txt

m = A("m")
b = B("b")
a = C("a")
k = D("k")
c = E("c")
d = F("d")
n = G("n")
g = H("g")

m.x = a
b.x = d
b.u = d
a.w = c
a.y = m
a.o = m
a.z = b
k.y = a
k.t = c
c.v = n
c.s = n
d.q = m
d.w = b
n.t = a
n.p = a
g.v = a
g.u = m
g.o = m
g.p = b
g.r = c
g.t = c
assert d.q.x.z.u.w.u.w.txt == "b"