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

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

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

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

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

d = A("d")
e = B("e")
l = C("l")
j = D("j")
b = E("b")
f = D("f")

d.s = l
e.v = l
e.p = l
e.s = l
e.w = f
e.t = d
l.z = b
l.o = d
l.x = j
j.x = d
j.r = d
b.z = d
b.x = d
f.x = d
f.r = d
assert l.x.x.s.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

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

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

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

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

d = A("d")
e = B("e")
l = C("l")
j = D("j")
b = E("b")
f = D("f")

d.s = l
e.v = l
e.p = l
e.s = l
e.w = f
e.t = d
l.z = b
l.o = d
l.x = j
j.x = d
j.r = d
b.z = d
b.x = d
f.x = d
f.r = d
assert l.x.x.s.x.x.txt == "d"