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

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

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

class D:
    def __init__(self, txt: str):
        self.x: B = None
        self.r: C = None
        self.txt = txt

m = A("m")
c = B("c")
e = C("e")
l = D("l")
h = D("h")
n = B("n")

m.z = l
c.z = n
c.x = m
c.t = e
e.s = c
e.x = c
l.x = c
l.r = e
h.x = c
h.r = e
n.z = c
n.x = m
n.t = e
assert l.r.x.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.x: B = None
        self.r: C = None
        self.txt = txt

m = A("m")
c = B("c")
e = C("e")
l = D("l")
h = D("h")
n = B("n")

m.z = l
c.z = n
c.x = m
c.t = e
e.s = c
e.x = c
l.x = c
l.r = e
h.x = c
h.r = e
n.z = c
n.x = m
n.t = e
assert l.r.x.z.z.txt == "c"