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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.o: G = None
        self.txt = txt

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

m = A("m")
c = B("c")
k = C("k")
b = D("b")
f = E("f")
h = F("h")
a = G("a")

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.o: G = None
        self.txt = txt

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

m = A("m")
c = B("c")
k = C("k")
b = D("b")
f = E("f")
h = F("h")
a = G("a")

m.t = a
m.z = a
c.w = m
c.t = b
c.r = b
c.p = a
k.q = m
k.x = f
k.o = h
k.r = c
k.y = a
k.v = a
k.u = a
b.t = m
b.w = m
f.t = a
f.y = h
h.o = a
a.u = c
a.w = f
a.s = f
a.t = k
a.x = m
a.y = b
assert a.x.z.t.q.z.t.txt == "k"