class A:
    def __init__(self, txt: str):
        self.s: E = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.u: A = None
        self.s: B = None
        self.txt = txt

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

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.u: A = None
        self.s: B = None
        self.txt = txt

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

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

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