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

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

f = A("f")
l = B("l")
g = C("g")
c = D("c")
e = E("e")
b = F("b")

f.v = l
f.x = l
f.z = g
l.p = c
l.v = c
l.y = f
g.w = e
g.y = c
c.z = f
e.y = l
b.y = g
b.z = e
assert c.z.z.y.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.x: B = None
        self.z: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

f = A("f")
l = B("l")
g = C("g")
c = D("c")
e = E("e")
b = F("b")

f.v = l
f.x = l
f.z = g
l.p = c
l.v = c
l.y = f
g.w = e
g.y = c
c.z = f
e.y = l
b.y = g
b.z = e
assert c.z.z.y.z.z.txt == "g"