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

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

class C:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.z: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: F = None
        self.txt = txt

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

k = A("k")
a = B("a")
b = C("b")
d = D("d")
l = E("l")
i = F("i")

k.s = a
a.y = l
a.u = l
a.s = d
a.w = k
b.p = l
d.p = a
d.z = k
l.p = i
i.x = k
assert d.p.u.p.x.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.z: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: F = None
        self.txt = txt

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

k = A("k")
a = B("a")
b = C("b")
d = D("d")
l = E("l")
i = F("i")

k.s = a
a.y = l
a.u = l
a.s = d
a.w = k
b.p = l
d.p = a
d.z = k
l.p = i
i.x = k
assert d.p.u.p.x.s.txt == "a"