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

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

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

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

i = A("i")
a = B("a")
j = C("j")
h = D("h")
k = D("k")
c = B("c")
e = C("e")
d = B("d")

i.t = d
a.s = i
a.x = i
a.t = j
a.o = c
j.s = k
h.o = a
h.z = e
h.r = k
k.o = d
k.z = e
k.r = h
c.s = i
c.x = i
c.t = e
c.o = d
e.s = k
d.s = i
d.x = i
d.t = j
d.o = a
assert h.r.z.s.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

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

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

i = A("i")
a = B("a")
j = C("j")
h = D("h")
k = D("k")
c = B("c")
e = C("e")
d = B("d")

i.t = d
a.s = i
a.x = i
a.t = j
a.o = c
j.s = k
h.o = a
h.z = e
h.r = k
k.o = d
k.z = e
k.r = h
c.s = i
c.x = i
c.t = e
c.o = d
e.s = k
d.s = i
d.x = i
d.t = j
d.o = a
assert h.r.z.s.txt == "k"