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

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

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

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

g = A("g")
j = B("j")
h = C("h")
l = D("l")
f = A("f")

g.o = j
g.r = j
g.u = h
g.t = f
j.s = l
h.u = f
l.t = j
l.y = j
f.o = j
f.r = j
f.u = h
f.t = g
assert h.u.u.u.r.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.u: C = None
        self.r: B = None
        self.t: A = None
        self.txt = txt

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

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

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

g = A("g")
j = B("j")
h = C("h")
l = D("l")
f = A("f")

g.o = j
g.r = j
g.u = h
g.t = f
j.s = l
h.u = f
l.t = j
l.y = j
f.o = j
f.r = j
f.u = h
f.t = g
assert h.u.u.u.r.txt == "j"