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

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

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

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

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

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

k = A("k")
g = B("g")
a = C("a")
m = D("m")
b = E("b")
d = F("d")
e = C("e")
h = E("h")
f = E("f")
i = A("i")

k.u = b
k.s = i
k.p = g
g.s = i
g.t = b
g.p = d
a.u = f
a.x = g
a.z = e
a.y = m
a.s = m
m.o = a
b.x = g
b.o = m
d.t = g
e.u = h
e.x = g
e.z = a
e.y = m
e.s = m
h.x = g
h.o = m
f.x = g
f.o = m
i.u = b
i.s = k
i.p = g
assert h.o.o.z.x.t.x.txt == "
class A:
    def __init__(self, txt: str):
        self.u: E = None
        self.s: A = None
        self.p: B = None
        self.txt = txt

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

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

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

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

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

k = A("k")
g = B("g")
a = C("a")
m = D("m")
b = E("b")
d = F("d")
e = C("e")
h = E("h")
f = E("f")
i = A("i")

k.u = b
k.s = i
k.p = g
g.s = i
g.t = b
g.p = d
a.u = f
a.x = g
a.z = e
a.y = m
a.s = m
m.o = a
b.x = g
b.o = m
d.t = g
e.u = h
e.x = g
e.z = a
e.y = m
e.s = m
h.x = g
h.o = m
f.x = g
f.o = m
i.u = b
i.s = k
i.p = g
assert h.o.o.z.x.t.x.txt == "g"