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

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

class C:
    def __init__(self, txt: str):
        self.s: C = None
        self.u: D = None
        self.r: G = None
        self.v: A = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.u: E = None
        self.r: A = None
        self.t: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: F = None
        self.z: A = None
        self.o: E = None
        self.s: B = None
        self.txt = txt

j = A("j")
k = B("k")
h = C("h")
m = D("m")
b = E("b")
e = F("e")
d = G("d")
f = C("f")
n = B("n")
a = D("a")

j.r = b
j.t = a
k.r = n
h.s = f
h.u = m
h.r = d
h.v = j
m.z = e
b.q = a
b.p = f
b.x = e
b.r = h
b.o = j
e.u = b
e.t = b
e.r = j
d.r = e
d.z = j
d.o = b
d.s = n
f.s = h
f.u = a
f.r = d
f.v = j
n.r = k
a.z = e
assert m.z.r.t.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.t: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: C = None
        self.u: D = None
        self.r: G = None
        self.v: A = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.u: E = None
        self.r: A = None
        self.t: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: F = None
        self.z: A = None
        self.o: E = None
        self.s: B = None
        self.txt = txt

j = A("j")
k = B("k")
h = C("h")
m = D("m")
b = E("b")
e = F("e")
d = G("d")
f = C("f")
n = B("n")
a = D("a")

j.r = b
j.t = a
k.r = n
h.s = f
h.u = m
h.r = d
h.v = j
m.z = e
b.q = a
b.p = f
b.x = e
b.r = h
b.o = j
e.u = b
e.t = b
e.r = j
d.r = e
d.z = j
d.o = b
d.s = n
f.s = h
f.u = a
f.r = d
f.v = j
n.r = k
a.z = e
assert m.z.r.t.z.txt == "e"