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

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

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

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

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

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

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

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

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

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

n.w = h
n.u = h
n.x = j
n.s = g
h.x = j
g.r = h
g.o = j
g.v = j
j.z = n
assert j.z.s.v.txt == "j"