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

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

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

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

m = A("m")
c = B("c")
b = C("b")
l = D("l")
n = D("n")
i = D("i")

m.p = b
c.v = l
c.q = l
c.t = m
b.y = m
l.p = n
l.t = n
l.w = m
l.y = m
n.p = i
n.t = i
n.w = m
n.y = m
i.p = l
i.t = l
i.w = m
i.y = m
assert b.y.p.y.p.y.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

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

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

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

m = A("m")
c = B("c")
b = C("b")
l = D("l")
n = D("n")
i = D("i")

m.p = b
c.v = l
c.q = l
c.t = m
b.y = m
l.p = n
l.t = n
l.w = m
l.y = m
n.p = i
n.t = i
n.w = m
n.y = m
i.p = l
i.t = l
i.w = m
i.y = m
assert b.y.p.y.p.y.p.txt == "b"