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

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

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

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

d = A("d")
f = B("f")
e = C("e")
l = D("l")
c = D("c")
i = D("i")
j = A("j")

d.x = f
f.z = e
f.y = e
f.s = e
e.r = d
e.t = f
l.y = c
l.o = e
l.x = i
l.p = f
c.y = i
c.o = e
c.x = l
c.p = f
i.y = c
i.o = e
i.x = l
i.p = f
j.x = f
assert i.o.r.x.z.r.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

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

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

d = A("d")
f = B("f")
e = C("e")
l = D("l")
c = D("c")
i = D("i")
j = A("j")

d.x = f
f.z = e
f.y = e
f.s = e
e.r = d
e.t = f
l.y = c
l.o = e
l.x = i
l.p = f
c.y = i
c.o = e
c.x = l
c.p = f
i.y = c
i.o = e
i.x = l
i.p = f
j.x = f
assert i.o.r.x.z.r.x.txt == "f"