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

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

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

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

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

k.y = l
h.q = i
h.p = e
h.s = b
e.t = h
i.r = l
i.q = h
i.v = k
i.w = e
l.q = i
l.p = e
l.s = b
m.t = h
b.y = l
assert i.q.p.t.q.v.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

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

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

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

k.y = l
h.q = i
h.p = e
h.s = b
e.t = h
i.r = l
i.q = h
i.v = k
i.w = e
l.q = i
l.p = e
l.s = b
m.t = h
b.y = l
assert i.q.p.t.q.v.y.txt == "l"