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

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

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

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

g = A("g")
m = B("m")
e = C("e")
n = D("n")
j = D("j")

g.z = e
g.x = e
g.s = j
m.u = g
m.t = e
m.s = e
e.t = g
e.z = m
n.t = j
n.z = j
n.w = j
n.y = e
j.t = n
j.z = n
j.w = n
j.y = e
assert e.t.s.y.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.x: C = None
        self.s: D = None
        self.txt = txt

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

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

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

g = A("g")
m = B("m")
e = C("e")
n = D("n")
j = D("j")

g.z = e
g.x = e
g.s = j
m.u = g
m.t = e
m.s = e
e.t = g
e.z = m
n.t = j
n.z = j
n.w = j
n.y = e
j.t = n
j.z = n
j.w = n
j.y = e
assert e.t.s.y.txt == "e"