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

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

class C:
    def __init__(self, txt: str):
        self.z: E = None
        self.u: F = None
        self.x: H = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: C = None
        self.w: C = None
        self.t: F = None
        self.u: A = None
        self.s: B = None
        self.x: G = None
        self.p: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: H = None
        self.y: C = None
        self.u: B = None
        self.w: F = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.o: A = None
        self.x: C = None
        self.s: G = None
        self.u: G = None
        self.z: G = None
        self.q: C = None
        self.p: A = None
        self.y: G = None
        self.txt = txt

b = A("b")
c = B("c")
f = C("f")
i = D("i")
m = E("m")
l = F("l")
e = G("e")
g = H("g")
a = B("a")

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

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

class C:
    def __init__(self, txt: str):
        self.z: E = None
        self.u: F = None
        self.x: H = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: C = None
        self.w: C = None
        self.t: F = None
        self.u: A = None
        self.s: B = None
        self.x: G = None
        self.p: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: H = None
        self.y: C = None
        self.u: B = None
        self.w: F = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.o: A = None
        self.x: C = None
        self.s: G = None
        self.u: G = None
        self.z: G = None
        self.q: C = None
        self.p: A = None
        self.y: G = None
        self.txt = txt

b = A("b")
c = B("c")
f = C("f")
i = D("i")
m = E("m")
l = F("l")
e = G("e")
g = H("g")
a = B("a")

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