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

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

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

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

f = A("f")
i = B("i")
n = C("n")
g = D("g")
j = C("j")
k = C("k")
l = B("l")

f.s = g
f.u = g
i.q = f
n.t = f
n.r = k
n.s = k
n.w = i
g.o = f
j.t = f
j.r = k
j.w = i
j.s = n
k.t = f
k.r = j
k.s = j
k.w = i
l.q = f
assert j.r.t.s.o.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.u: D = None
        self.txt = txt

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

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

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

f = A("f")
i = B("i")
n = C("n")
g = D("g")
j = C("j")
k = C("k")
l = B("l")

f.s = g
f.u = g
i.q = f
n.t = f
n.r = k
n.s = k
n.w = i
g.o = f
j.t = f
j.r = k
j.w = i
j.s = n
k.t = f
k.r = j
k.s = j
k.w = i
l.q = f
assert j.r.t.s.o.s.txt == "g"