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

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

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

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

l = A("l")
i = B("i")
e = C("e")
h = D("h")
d = B("d")
b = B("b")
m = D("m")

l.t = e
i.o = e
e.y = m
h.r = d
d.o = e
b.o = e
m.r = i
assert b.o.y.r.o.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

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

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

l = A("l")
i = B("i")
e = C("e")
h = D("h")
d = B("d")
b = B("b")
m = D("m")

l.t = e
i.o = e
e.y = m
h.r = d
d.o = e
b.o = e
m.r = i
assert b.o.y.r.o.txt == "e"