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

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

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

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

l = A("l")
h = B("h")
g = C("g")
n = D("n")
b = A("b")
j = B("j")
d = A("d")

l.v = b
l.w = j
l.o = n
h.y = j
h.w = n
h.q = n
g.q = l
g.x = h
n.s = g
n.o = h
n.t = h
n.z = j
b.v = d
b.w = h
b.o = n
j.y = h
j.w = n
j.q = n
d.v = b
d.w = j
d.o = n
assert b.o.s.x.w.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.w: B = None
        self.o: D = None
        self.txt = txt

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

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

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

l = A("l")
h = B("h")
g = C("g")
n = D("n")
b = A("b")
j = B("j")
d = A("d")

l.v = b
l.w = j
l.o = n
h.y = j
h.w = n
h.q = n
g.q = l
g.x = h
n.s = g
n.o = h
n.t = h
n.z = j
b.v = d
b.w = h
b.o = n
j.y = h
j.w = n
j.q = n
d.v = b
d.w = j
d.o = n
assert b.o.s.x.w.txt == "n"