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

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

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

e = A("e")
a = B("a")
d = C("d")
f = B("f")
n = A("n")
i = C("i")
k = C("k")
j = A("j")
m = C("m")
c = B("c")

e.w = n
e.y = f
a.y = c
a.r = d
d.v = j
f.y = a
f.r = k
n.w = j
n.y = a
i.v = j
k.v = j
j.w = e
j.y = a
m.v = n
c.y = a
c.r = d
assert j.w.y.r.v.y.y.r.v.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.y: B = None
        self.txt = txt

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

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

e = A("e")
a = B("a")
d = C("d")
f = B("f")
n = A("n")
i = C("i")
k = C("k")
j = A("j")
m = C("m")
c = B("c")

e.w = n
e.y = f
a.y = c
a.r = d
d.v = j
f.y = a
f.r = k
n.w = j
n.y = a
i.v = j
k.v = j
j.w = e
j.y = a
m.v = n
c.y = a
c.r = d
assert j.w.y.r.v.y.y.r.v.txt == "j"