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

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

l = A("l")
k = B("k")
e = A("e")
n = A("n")
d = A("d")
b = B("b")

l.z = k
l.r = k
k.p = n
k.t = b
e.z = b
e.r = b
n.z = b
n.r = b
d.z = k
d.r = b
b.p = n
b.t = k
assert d.r.p.r.p.r.t.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.r: B = None
        self.txt = txt

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

l = A("l")
k = B("k")
e = A("e")
n = A("n")
d = A("d")
b = B("b")

l.z = k
l.r = k
k.p = n
k.t = b
e.z = b
e.r = b
n.z = b
n.r = b
d.z = k
d.r = b
b.p = n
b.t = k
assert d.r.p.r.p.r.t.txt == "k"