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

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

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

class D:
    def __init__(self, txt: str):
        self.w: A = None
        self.r: B = None
        self.y: B = None
        self.p: B = None
        self.txt = txt

j = A("j")
h = B("h")
n = C("n")
e = D("e")

j.y = n
j.u = n
j.s = e
j.p = h
h.s = e
h.z = e
h.y = e
h.v = j
n.y = e
n.s = e
e.w = j
e.r = h
e.y = h
e.p = h
assert h.y.y.v.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.u: C = None
        self.s: D = None
        self.p: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: A = None
        self.r: B = None
        self.y: B = None
        self.p: B = None
        self.txt = txt

j = A("j")
h = B("h")
n = C("n")
e = D("e")

j.y = n
j.u = n
j.s = e
j.p = h
h.s = e
h.z = e
h.y = e
h.v = j
n.y = e
n.s = e
e.w = j
e.r = h
e.y = h
e.p = h
assert h.y.y.v.txt == "j"