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

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

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

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

e = A("e")
h = B("h")
l = C("l")
n = D("n")

e.q = n
h.r = l
h.y = l
h.q = n
l.t = e
l.p = n
l.v = h
n.s = l
n.w = l
n.o = l
n.q = e
assert h.r.t.q.o.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

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

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

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

e = A("e")
h = B("h")
l = C("l")
n = D("n")

e.q = n
h.r = l
h.y = l
h.q = n
l.t = e
l.p = n
l.v = h
n.s = l
n.w = l
n.o = l
n.q = e
assert h.r.t.q.o.txt == "l"