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

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

f = A("f")
j = B("j")
k = A("k")
l = A("l")
m = A("m")

f.t = j
f.v = j
j.p = l
k.t = j
k.v = j
l.t = j
l.v = j
m.t = j
m.v = j
assert j.p.v.p.v.p.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.v: B = None
        self.txt = txt

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

f = A("f")
j = B("j")
k = A("k")
l = A("l")
m = A("m")

f.t = j
f.v = j
j.p = l
k.t = j
k.v = j
l.t = j
l.v = j
m.t = j
m.v = j
assert j.p.v.p.v.p.txt == "l"