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

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

d = A("d")
e = B("e")
c = A("c")
a = A("a")
f = B("f")
l = B("l")
n = A("n")
j = B("j")
m = A("m")

d.z = c
d.p = f
e.s = n
e.r = l
c.z = m
c.p = l
a.z = c
a.p = e
f.s = d
f.r = j
l.s = d
l.r = j
n.z = c
n.p = j
j.s = c
j.r = f
m.z = a
m.p = e
assert l.s.z.p.r.s.z.z.p.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.p: B = None
        self.txt = txt

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

d = A("d")
e = B("e")
c = A("c")
a = A("a")
f = B("f")
l = B("l")
n = A("n")
j = B("j")
m = A("m")

d.z = c
d.p = f
e.s = n
e.r = l
c.z = m
c.p = l
a.z = c
a.p = e
f.s = d
f.r = j
l.s = d
l.r = j
n.z = c
n.p = j
j.s = c
j.r = f
m.z = a
m.p = e
assert l.s.z.p.r.s.z.z.p.txt == "e"