class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.t: D = None
        self.q: H = None
        self.w: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.x: E = None
        self.t: E = None
        self.w: A = None
        self.y: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.x: A = None
        self.o: G = None
        self.y: A = None
        self.q: F = None
        self.w: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: D = None
        self.w: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.t: F = None
        self.y: H = None
        self.s: F = None
        self.u: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.x: E = None
        self.t: E = None
        self.w: A = None
        self.y: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.x: A = None
        self.o: G = None
        self.y: A = None
        self.q: F = None
        self.w: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: D = None
        self.w: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.t: F = None
        self.y: H = None
        self.s: F = None
        self.u: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

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

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