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

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

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

class D:
    def __init__(self, txt: str):
        self.u: B = None
        self.w: D = None
        self.y: B = None
        self.t: D = None
        self.txt = txt

f = A("f")
l = B("l")
j = C("j")
g = D("g")
m = D("m")
i = C("i")
a = A("a")
b = A("b")
n = B("n")

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

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

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

class D:
    def __init__(self, txt: str):
        self.u: B = None
        self.w: D = None
        self.y: B = None
        self.t: D = None
        self.txt = txt

f = A("f")
l = B("l")
j = C("j")
g = D("g")
m = D("m")
i = C("i")
a = A("a")
b = A("b")
n = B("n")

f.o = b
l.z = j
l.u = j
l.v = i
l.y = a
j.z = n
j.s = b
j.w = i
j.y = i
g.u = l
g.w = m
g.t = m
g.y = n
m.u = l
m.y = l
m.w = g
m.t = g
i.z = n
i.s = b
i.w = j
i.y = j
a.o = f
b.o = f
n.z = j
n.v = j
n.u = j
n.y = a
assert n.u.w.w.z.v.y.w.z.v.txt == "j"