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

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: D = None
        self.t: A = None
        self.s: F = None
        self.z: G = None
        self.q: D = None
        self.o: C = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.x: A = None
        self.r: D = None
        self.s: C = None
        self.t: E = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: D = None
        self.t: A = None
        self.s: F = None
        self.z: G = None
        self.q: D = None
        self.o: C = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.x: A = None
        self.r: D = None
        self.s: C = None
        self.t: E = None
        self.txt = txt

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

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