class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.o: A = None
        self.t: B = None
        self.y: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.o: D = None
        self.q: B = None
        self.txt = txt

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

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

a = A("a")
m = B("m")
g = C("g")
h = D("h")
j = C("j")
i = D("i")
k = A("k")
n = B("n")

a.s = h
a.o = k
a.y = k
a.t = n
m.s = k
m.o = h
m.q = n
g.x = j
h.u = g
j.x = g
i.u = g
k.s = h
k.o = a
k.y = a
k.t = m
n.s = a
n.o = i
n.q = m
assert k.s.u.x.x.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.o: A = None
        self.t: B = None
        self.y: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.o: D = None
        self.q: B = None
        self.txt = txt

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

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

a = A("a")
m = B("m")
g = C("g")
h = D("h")
j = C("j")
i = D("i")
k = A("k")
n = B("n")

a.s = h
a.o = k
a.y = k
a.t = n
m.s = k
m.o = h
m.q = n
g.x = j
h.u = g
j.x = g
i.u = g
k.s = h
k.o = a
k.y = a
k.t = m
n.s = a
n.o = i
n.q = m
assert k.s.u.x.x.x.x.x.txt == "j"