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

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

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.u: B = None
        self.r: B = None
        self.t: E = None
        self.z: G = None
        self.x: G = None
        self.y: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.t: A = None
        self.u: F = None
        self.r: F = None
        self.z: G = None
        self.v: D = None
        self.p: B = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.u: B = None
        self.r: B = None
        self.t: E = None
        self.z: G = None
        self.x: G = None
        self.y: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.t: A = None
        self.u: F = None
        self.r: F = None
        self.z: G = None
        self.v: D = None
        self.p: B = None
        self.txt = txt

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

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