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

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

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

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

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

m.w = n
m.p = n
m.v = e
n.w = e
l.v = b
l.s = d
e.q = f
e.v = n
f.q = e
f.v = n
i.v = n
i.s = m
c.w = n
c.p = b
c.v = e
d.w = b
d.p = b
d.v = f
b.w = f
assert e.v.w.q.q.v.w.v.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.p: B = None
        self.v: D = None
        self.txt = txt

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

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

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

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

m.w = n
m.p = n
m.v = e
n.w = e
l.v = b
l.s = d
e.q = f
e.v = n
f.q = e
f.v = n
i.v = n
i.s = m
c.w = n
c.p = b
c.v = e
d.w = b
d.p = b
d.v = f
b.w = f
assert e.v.w.q.q.v.w.v.txt == "n"