class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.q: E = None
        self.y: E = None
        self.p: C = None
        self.x: E = None
        self.u: C = None
        self.txt = txt

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

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

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

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

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

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

k.z = f
k.q = b
k.y = b
k.x = b
k.p = c
k.u = c
l.y = n
l.x = c
c.u = f
f.v = n
f.x = b
f.p = c
b.x = k
n.v = k
assert b.x.q.x.y.x.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.q: E = None
        self.y: E = None
        self.p: C = None
        self.x: E = None
        self.u: C = None
        self.txt = txt

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

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

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

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

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

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

k.z = f
k.q = b
k.y = b
k.x = b
k.p = c
k.u = c
l.y = n
l.x = c
c.u = f
f.v = n
f.x = b
f.p = c
b.x = k
n.v = k
assert b.x.q.x.y.x.z.txt == "f"