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

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

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

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

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

i.y = g
j.o = h
j.w = g
j.t = g
h.v = g
h.r = j
h.u = j
h.o = i
g.w = j
g.v = h
assert h.o.y.v.u.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.txt = txt

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

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

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

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

i.y = g
j.o = h
j.w = g
j.t = g
h.v = g
h.r = j
h.u = j
h.o = i
g.w = j
g.v = h
assert h.o.y.v.u.txt == "j"