class A:
    def __init__(self, txt: str):
        self.t: F = None
        self.p: B = None
        self.o: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.t: D = None
        self.z: G = None
        self.y: C = None
        self.p: A = None
        self.q: G = None
        self.w: H = None
        self.x: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: E = None
        self.s: B = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.w: G = None
        self.o: C = None
        self.s: D = None
        self.x: H = None
        self.txt = txt

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

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

k = A("k")
j = B("j")
f = C("f")
i = D("i")
m = E("m")
c = F("c")
h = G("h")
g = H("g")

k.t = c
k.p = j
k.o = j
j.u = i
j.t = i
j.z = h
j.q = h
j.y = f
j.p = k
j.x = k
j.w = g
f.q = m
f.s = j
i.x = k
m.z = f
m.u = c
m.r = i
c.w = h
c.o = f
c.s = i
c.x = g
h.t = c
h.p = c
h.x = k
g.y = i
g.z = c
assert m.r.x.t.x.txt == "
class A:
    def __init__(self, txt: str):
        self.t: F = None
        self.p: B = None
        self.o: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.t: D = None
        self.z: G = None
        self.y: C = None
        self.p: A = None
        self.q: G = None
        self.w: H = None
        self.x: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: E = None
        self.s: B = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.w: G = None
        self.o: C = None
        self.s: D = None
        self.x: H = None
        self.txt = txt

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

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

k = A("k")
j = B("j")
f = C("f")
i = D("i")
m = E("m")
c = F("c")
h = G("h")
g = H("g")

k.t = c
k.p = j
k.o = j
j.u = i
j.t = i
j.z = h
j.q = h
j.y = f
j.p = k
j.x = k
j.w = g
f.q = m
f.s = j
i.x = k
m.z = f
m.u = c
m.r = i
c.w = h
c.o = f
c.s = i
c.x = g
h.t = c
h.p = c
h.x = k
g.y = i
g.z = c
assert m.r.x.t.x.txt == "g"