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

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

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

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

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

e.r = c
e.s = a
i.r = l
i.u = l
i.z = d
d.s = j
d.y = i
d.p = i
d.o = e
c.y = e
c.r = a
h.r = c
h.s = j
l.s = h
l.y = i
l.p = i
l.o = j
a.r = c
a.s = j
j.r = c
j.s = h
assert e.s.s.s.s.r.y.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.s: A = None
        self.txt = txt

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

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

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

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

e.r = c
e.s = a
i.r = l
i.u = l
i.z = d
d.s = j
d.y = i
d.p = i
d.o = e
c.y = e
c.r = a
h.r = c
h.s = j
l.s = h
l.y = i
l.p = i
l.o = j
a.r = c
a.s = j
j.r = c
j.s = h
assert e.s.s.s.s.r.y.txt == "e"