class A:
    def __init__(self, txt: str):
        self.r: G = None
        self.z: G = None
        self.y: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.s: B = None
        self.p: E = None
        self.x: A = None
        self.q: A = None
        self.t: C = None
        self.txt = txt

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

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

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

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

n.r = h
n.z = h
n.y = m
m.t = h
m.w = f
e.t = m
g.o = m
g.s = m
g.p = b
g.x = n
g.q = n
g.t = e
b.v = f
b.w = l
b.x = n
f.z = e
f.r = e
f.p = h
h.t = g
h.w = f
l.v = f
l.w = b
l.x = n
assert m.t.w.z.t.txt == "
class A:
    def __init__(self, txt: str):
        self.r: G = None
        self.z: G = None
        self.y: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.s: B = None
        self.p: E = None
        self.x: A = None
        self.q: A = None
        self.t: C = None
        self.txt = txt

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

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

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

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

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