class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.z: A = None
        self.txt = txt

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

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

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

b = A("b")
m = B("m")
e = C("e")
n = D("n")
d = C("d")
l = D("l")
f = A("f")
j = A("j")

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

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

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

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

b = A("b")
m = B("m")
e = C("e")
n = D("n")
d = C("d")
l = D("l")
f = A("f")
j = A("j")

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