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

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

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

i = A("i")
l = B("l")
j = C("j")
h = C("h")
b = A("b")
d = C("d")
n = C("n")
e = B("e")
f = B("f")

i.y = f
i.w = b
l.u = e
l.y = j
l.s = i
j.p = b
j.w = h
j.r = h
h.p = i
h.w = n
h.r = d
b.y = l
b.w = i
d.p = b
d.w = n
d.r = n
n.p = i
n.w = j
n.r = h
e.u = f
e.y = d
e.s = i
f.u = l
f.y = h
f.s = i
assert n.w.r.p.y.s.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.w: A = None
        self.txt = txt

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

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

i = A("i")
l = B("l")
j = C("j")
h = C("h")
b = A("b")
d = C("d")
n = C("n")
e = B("e")
f = B("f")

i.y = f
i.w = b
l.u = e
l.y = j
l.s = i
j.p = b
j.w = h
j.r = h
h.p = i
h.w = n
h.r = d
b.y = l
b.w = i
d.p = b
d.w = n
d.r = n
n.p = i
n.w = j
n.r = h
e.u = f
e.y = d
e.s = i
f.u = l
f.y = h
f.s = i
assert n.w.r.p.y.s.txt == "i"