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

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

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

j = A("j")
l = B("l")
k = C("k")
f = C("f")
n = A("n")
m = C("m")
d = B("d")
g = C("g")

j.v = n
l.w = j
l.o = d
k.y = j
k.s = f
k.u = n
f.y = n
f.s = m
f.u = j
n.v = j
m.y = j
m.s = f
m.u = n
d.w = j
d.o = l
g.y = j
g.u = j
g.s = k
assert d.w.v.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.txt = txt

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

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

j = A("j")
l = B("l")
k = C("k")
f = C("f")
n = A("n")
m = C("m")
d = B("d")
g = C("g")

j.v = n
l.w = j
l.o = d
k.y = j
k.s = f
k.u = n
f.y = n
f.s = m
f.u = j
n.v = j
m.y = j
m.s = f
m.u = n
d.w = j
d.o = l
g.y = j
g.u = j
g.s = k
assert d.w.v.v.v.txt == "n"