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

class B:
    def __init__(self, txt: str):
        self.u: C = None
        self.z: C = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: E = None
        self.o: D = None
        self.t: E = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.u: C = None
        self.z: C = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: E = None
        self.o: D = None
        self.t: E = None
        self.txt = txt

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

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

c.t = h
b.u = m
b.z = m
m.o = n
m.t = n
m.v = h
m.p = h
m.z = h
m.y = g
m.s = g
n.u = a
g.s = c
g.o = h
g.q = h
g.t = a
g.r = b
a.q = g
a.t = g
a.o = n
h.o = g
h.t = a
assert h.o.q.o.t.t.txt == "g"