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

class B:
    def __init__(self, txt: str):
        self.r: D = None
        self.x: C = None
        self.t: E = None
        self.v: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: D = None
        self.x: D = None
        self.q: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: C = None
        self.r: G = None
        self.s: G = None
        self.z: C = None
        self.x: B = None
        self.w: F = None
        self.t: C = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.s: F = None
        self.p: B = None
        self.q: C = None
        self.w: A = None
        self.x: A = None
        self.o: C = None
        self.y: E = None
        self.txt = txt

a = A("a")
i = B("i")
n = C("n")
f = D("f")
e = E("e")
h = F("h")
m = G("m")

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

class B:
    def __init__(self, txt: str):
        self.r: D = None
        self.x: C = None
        self.t: E = None
        self.v: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: D = None
        self.x: D = None
        self.q: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: C = None
        self.r: G = None
        self.s: G = None
        self.z: C = None
        self.x: B = None
        self.w: F = None
        self.t: C = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.s: F = None
        self.p: B = None
        self.q: C = None
        self.w: A = None
        self.x: A = None
        self.o: C = None
        self.y: E = None
        self.txt = txt

a = A("a")
i = B("i")
n = C("n")
f = D("f")
e = E("e")
h = F("h")
m = G("m")

a.t = f
i.r = f
i.x = n
i.v = n
i.t = e
n.y = f
n.x = f
n.q = m
f.u = n
f.z = n
f.t = n
f.r = m
f.s = m
f.x = i
f.w = h
e.p = f
e.z = f
e.t = m
e.o = i
e.x = h
e.r = h
e.q = n
h.v = i
m.s = h
m.p = i
m.q = n
m.o = n
m.w = a
m.x = a
m.y = e
assert n.y.x.r.z.q.y.t.txt == "m"