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

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

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

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

a = A("a")
g = B("g")
j = C("j")
b = D("b")
h = C("h")
f = B("f")
l = B("l")
c = D("c")
e = A("e")
k = B("k")

a.o = f
a.z = k
g.s = e
g.t = f
g.z = f
g.w = b
j.y = a
j.t = c
b.q = f
h.y = a
h.t = b
f.s = a
f.t = g
f.w = c
f.z = l
l.s = a
l.t = g
l.w = b
l.z = k
c.q = f
e.o = l
e.z = k
k.s = a
k.t = f
k.w = c
k.z = l
assert f.s.z.w.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.z: B = None
        self.txt = txt

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

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

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

a = A("a")
g = B("g")
j = C("j")
b = D("b")
h = C("h")
f = B("f")
l = B("l")
c = D("c")
e = A("e")
k = B("k")

a.o = f
a.z = k
g.s = e
g.t = f
g.z = f
g.w = b
j.y = a
j.t = c
b.q = f
h.y = a
h.t = b
f.s = a
f.t = g
f.w = c
f.z = l
l.s = a
l.t = g
l.w = b
l.z = k
c.q = f
e.o = l
e.z = k
k.s = a
k.t = f
k.w = c
k.z = l
assert f.s.z.w.txt == "c"