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

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

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

class D:
    def __init__(self, txt: str):
        self.r: B = None
        self.t: E = None
        self.p: C = None
        self.s: C = None
        self.txt = txt

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

d = A("d")
a = B("a")
h = C("h")
i = D("i")
b = E("b")
j = A("j")
k = E("k")

d.x = i
d.p = a
a.t = h
h.t = k
h.s = a
i.r = a
i.t = k
i.p = h
i.s = h
b.s = k
b.x = k
b.y = i
j.x = i
j.p = a
k.s = b
k.x = b
k.y = i
assert j.x.p.s.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.p: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.r: B = None
        self.t: E = None
        self.p: C = None
        self.s: C = None
        self.txt = txt

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

d = A("d")
a = B("a")
h = C("h")
i = D("i")
b = E("b")
j = A("j")
k = E("k")

d.x = i
d.p = a
a.t = h
h.t = k
h.s = a
i.r = a
i.t = k
i.p = h
i.s = h
b.s = k
b.x = k
b.y = i
j.x = i
j.p = a
k.s = b
k.x = b
k.y = i
assert j.x.p.s.t.t.txt == "k"