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

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

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

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

f = A("f")
j = B("j")
b = C("b")
g = D("g")
l = D("l")
e = B("e")
i = A("i")

f.x = l
f.s = e
f.u = i
j.y = e
b.x = f
g.z = l
g.t = b
g.r = f
g.s = e
l.z = g
l.t = b
l.r = i
l.s = j
e.y = j
i.x = l
i.s = j
i.u = f
assert b.x.x.s.y.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.s: B = None
        self.u: A = None
        self.txt = txt

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

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

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

f = A("f")
j = B("j")
b = C("b")
g = D("g")
l = D("l")
e = B("e")
i = A("i")

f.x = l
f.s = e
f.u = i
j.y = e
b.x = f
g.z = l
g.t = b
g.r = f
g.s = e
l.z = g
l.t = b
l.r = i
l.s = j
e.y = j
i.x = l
i.s = j
i.u = f
assert b.x.x.s.y.y.y.y.txt == "j"