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

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

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.x: B = None
        self.txt = txt

c = A("c")
k = B("k")
j = C("j")
l = B("l")
m = A("m")
f = C("f")
n = A("n")
e = A("e")

c.s = l
k.r = m
k.v = m
k.x = e
j.w = l
j.x = l
l.r = c
l.v = m
l.x = e
m.s = l
f.w = k
f.x = l
n.s = k
e.s = l
assert l.r.s.x.s.x.s.x.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.x: B = None
        self.txt = txt

c = A("c")
k = B("k")
j = C("j")
l = B("l")
m = A("m")
f = C("f")
n = A("n")
e = A("e")

c.s = l
k.r = m
k.v = m
k.x = e
j.w = l
j.x = l
l.r = c
l.v = m
l.x = e
m.s = l
f.w = k
f.x = l
n.s = k
e.s = l
assert l.r.s.x.s.x.s.x.txt == "e"