class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.u: C = None
        self.x: G = None
        self.v: C = None
        self.z: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.t: A = None
        self.txt = txt

d = A("d")
m = B("m")
h = C("h")
n = D("n")
k = E("k")
i = F("i")
c = G("c")
b = C("b")
g = F("g")

d.z = n
m.u = i
m.r = i
m.o = n
m.w = k
h.t = d
n.w = k
k.x = h
k.q = n
k.o = n
k.s = c
k.w = c
k.u = d
k.t = m
i.u = b
i.v = b
i.x = c
i.z = n
c.t = d
b.t = d
g.u = h
g.v = h
g.x = c
g.z = n
assert b.t.z.w.t.o.w.u.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.u: C = None
        self.x: G = None
        self.v: C = None
        self.z: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.t: A = None
        self.txt = txt

d = A("d")
m = B("m")
h = C("h")
n = D("n")
k = E("k")
i = F("i")
c = G("c")
b = C("b")
g = F("g")

d.z = n
m.u = i
m.r = i
m.o = n
m.w = k
h.t = d
n.w = k
k.x = h
k.q = n
k.o = n
k.s = c
k.w = c
k.u = d
k.t = m
i.u = b
i.v = b
i.x = c
i.z = n
c.t = d
b.t = d
g.u = h
g.v = h
g.x = c
g.z = n
assert b.t.z.w.t.o.w.u.z.txt == "n"