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

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

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

class D:
    def __init__(self, txt: str):
        self.t: A = None
        self.r: E = None
        self.v: B = None
        self.y: C = None
        self.txt = txt

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

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

b = A("b")
c = B("c")
j = C("j")
n = D("n")
e = E("e")
f = F("f")

b.p = n
b.z = j
c.x = f
c.w = f
c.y = f
c.v = e
j.x = f
j.w = f
j.p = n
j.q = n
j.z = b
j.y = b
n.t = b
n.r = e
n.v = c
n.y = j
e.x = f
e.p = n
f.y = c
assert n.y.z.z.x.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.z: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.t: A = None
        self.r: E = None
        self.v: B = None
        self.y: C = None
        self.txt = txt

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

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

b = A("b")
c = B("c")
j = C("j")
n = D("n")
e = E("e")
f = F("f")

b.p = n
b.z = j
c.x = f
c.w = f
c.y = f
c.v = e
j.x = f
j.w = f
j.p = n
j.q = n
j.z = b
j.y = b
n.t = b
n.r = e
n.v = c
n.y = j
e.x = f
e.p = n
f.y = c
assert n.y.z.z.x.txt == "f"