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

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

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

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

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

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

l = A("l")
k = B("k")
n = C("n")
b = D("b")
f = E("f")
a = F("a")

l.w = b
l.s = a
l.v = a
l.p = n
k.x = b
n.y = b
b.p = f
b.r = a
f.v = a
a.y = l
a.u = l
assert n.y.p.v.u.p.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.s: F = None
        self.v: F = None
        self.p: C = None
        self.txt = txt

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

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

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

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

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

l = A("l")
k = B("k")
n = C("n")
b = D("b")
f = E("f")
a = F("a")

l.w = b
l.s = a
l.v = a
l.p = n
k.x = b
n.y = b
b.p = f
b.r = a
f.v = a
a.y = l
a.u = l
assert n.y.p.v.u.p.txt == "n"