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

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

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

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

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

a.o = h
n.s = g
h.r = e
h.o = b
h.p = a
h.w = n
d.w = j
d.v = a
d.s = b
d.z = b
j.w = d
j.z = d
j.v = l
j.s = b
e.r = h
e.o = d
e.p = a
e.w = n
g.o = h
b.w = j
b.s = j
b.z = j
b.v = a
l.o = e
assert b.s.v.o.o.s.w.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

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

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

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

a.o = h
n.s = g
h.r = e
h.o = b
h.p = a
h.w = n
d.w = j
d.v = a
d.s = b
d.z = b
j.w = d
j.z = d
j.v = l
j.s = b
e.r = h
e.o = d
e.p = a
e.w = n
g.o = h
b.w = j
b.s = j
b.z = j
b.v = a
l.o = e
assert b.s.v.o.o.s.w.txt == "j"