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

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

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

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

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

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

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

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

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

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

c.p = n
c.t = f
f.s = i
a.v = m
k.y = j
j.v = a
n.p = c
n.t = f
m.v = j
i.s = f
assert j.v.v.v.v.v.v.v.txt == "a"