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

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

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

k = A("k")
j = B("j")
g = C("g")
n = C("n")
f = C("f")
e = B("e")
c = B("c")
i = B("i")

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

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

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

k = A("k")
j = B("j")
g = C("g")
n = C("n")
f = C("f")
e = B("e")
c = B("c")
i = B("i")

k.p = i
k.w = j
j.v = c
g.x = c
g.v = e
g.s = i
n.x = i
n.s = i
n.v = j
f.x = e
f.v = j
f.s = i
e.v = c
c.v = j
i.v = c
assert f.v.v.v.v.v.txt == "j"