class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: G = None
        self.p: F = None
        self.s: C = None
        self.u: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: A = None
        self.t: B = None
        self.r: F = None
        self.y: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.t: C = None
        self.p: D = None
        self.o: C = None
        self.v: D = None
        self.u: G = None
        self.txt = txt

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.y: G = None
        self.p: F = None
        self.s: C = None
        self.u: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: A = None
        self.t: B = None
        self.r: F = None
        self.y: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.t: C = None
        self.p: D = None
        self.o: C = None
        self.v: D = None
        self.u: G = None
        self.txt = txt

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

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

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

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