class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.y: C = None
        self.w: B = None
        self.x: D = None
        self.txt = txt

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

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

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

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

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

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

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

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

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

f.s = n
f.y = n
f.w = b
f.x = k
a.o = j
n.q = a
n.r = a
n.t = l
k.o = l
k.z = j
b.o = j
l.s = n
l.y = n
l.w = a
l.x = k
j.o = l
j.z = k
assert l.w.o.z.z.z.txt == "k"