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

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

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

m = A("m")
f = B("f")
c = C("c")
g = A("g")
h = A("h")
j = A("j")
k = A("k")
a = B("a")

m.r = a
m.s = a
m.p = c
f.s = a
f.y = j
f.p = c
c.v = f
c.r = f
c.t = f
g.r = f
g.s = f
g.p = c
h.r = f
h.p = c
h.s = a
j.r = f
j.p = c
j.s = a
k.r = f
k.p = c
k.s = a
a.s = f
a.y = k
a.p = c
assert m.s.p.v.s.y.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.p: C = None
        self.s: B = None
        self.txt = txt

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

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

m = A("m")
f = B("f")
c = C("c")
g = A("g")
h = A("h")
j = A("j")
k = A("k")
a = B("a")

m.r = a
m.s = a
m.p = c
f.s = a
f.y = j
f.p = c
c.v = f
c.r = f
c.t = f
g.r = f
g.s = f
g.p = c
h.r = f
h.p = c
h.s = a
j.r = f
j.p = c
j.s = a
k.r = f
k.p = c
k.s = a
a.s = f
a.y = k
a.p = c
assert m.s.p.v.s.y.txt == "k"