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

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

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

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

k = A("k")
a = B("a")
j = C("j")
l = D("l")
b = A("b")
f = C("f")
n = C("n")

k.o = b
k.q = l
a.z = b
a.o = b
a.w = b
a.x = l
j.t = a
j.p = l
j.z = k
l.v = b
l.o = a
b.o = k
b.q = l
f.t = a
f.p = l
f.z = b
n.t = a
n.p = l
n.z = k
assert j.z.o.q.o.o.q.v.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.q: D = None
        self.txt = txt

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

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

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

k = A("k")
a = B("a")
j = C("j")
l = D("l")
b = A("b")
f = C("f")
n = C("n")

k.o = b
k.q = l
a.z = b
a.o = b
a.w = b
a.x = l
j.t = a
j.p = l
j.z = k
l.v = b
l.o = a
b.o = k
b.q = l
f.t = a
f.p = l
f.z = b
n.t = a
n.p = l
n.z = k
assert j.z.o.q.o.o.q.v.txt == "b"