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

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

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

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

e.y = h
e.r = l
j.p = d
j.y = d
j.s = e
h.u = j
d.p = l
d.y = j
d.s = e
l.p = d
l.y = j
l.s = e
i.y = h
i.r = j
assert e.y.u.p.y.s.r.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.r: B = None
        self.txt = txt

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

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

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

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