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

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

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

class D:
    def __init__(self, txt: str):
        self.y: G = None
        self.o: B = None
        self.t: E = 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.v: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.w: C = None
        self.u: C = None
        self.q: F = None
        self.v: C = None
        self.r: E = None
        self.x: F = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.y: G = None
        self.o: B = None
        self.t: E = 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.v: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.w: C = None
        self.u: C = None
        self.q: F = None
        self.v: C = None
        self.r: E = None
        self.x: F = None
        self.txt = txt

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

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