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

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

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

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

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

b = A("b")
h = B("h")
c = C("c")
e = D("e")
i = E("i")
d = B("d")
k = A("k")

b.y = e
b.s = c
h.t = d
h.v = k
h.s = e
h.p = i
c.o = i
e.y = i
i.r = h
i.p = c
i.z = c
i.x = d
i.s = e
d.t = h
d.v = k
d.s = e
d.p = i
k.y = e
k.s = c
assert d.t.p.s.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.s: C = None
        self.txt = txt

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

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

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

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

b = A("b")
h = B("h")
c = C("c")
e = D("e")
i = E("i")
d = B("d")
k = A("k")

b.y = e
b.s = c
h.t = d
h.v = k
h.s = e
h.p = i
c.o = i
e.y = i
i.r = h
i.p = c
i.z = c
i.x = d
i.s = e
d.t = h
d.v = k
d.s = e
d.p = i
k.y = e
k.s = c
assert d.t.p.s.y.txt == "i"