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

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

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

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

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

b.w = k
n.q = b
n.x = k
f.v = k
k.o = d
k.x = d
k.t = d
k.s = c
l.v = k
j.q = b
j.x = k
e.v = k
d.w = k
c.v = k
m.v = k
assert l.v.s.v.x.w.s.v.s.v.s.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

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

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

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

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

b.w = k
n.q = b
n.x = k
f.v = k
k.o = d
k.x = d
k.t = d
k.s = c
l.v = k
j.q = b
j.x = k
e.v = k
d.w = k
c.v = k
m.v = k
assert l.v.s.v.x.w.s.v.s.v.s.txt == "c"