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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.x: E = None
        self.z: C = None
        self.s: C = None
        self.t: A = None
        self.y: B = None
        self.p: C = None
        self.txt = txt

f = A("f")
j = B("j")
n = C("n")
b = D("b")
i = E("i")
g = F("g")

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.x: E = None
        self.z: C = None
        self.s: C = None
        self.t: A = None
        self.y: B = None
        self.p: C = None
        self.txt = txt

f = A("f")
j = B("j")
n = C("n")
b = D("b")
i = E("i")
g = F("g")

f.w = b
f.x = i
f.q = i
j.s = n
j.v = b
j.y = g
j.p = i
n.x = j
n.r = i
b.r = j
b.t = i
b.v = f
b.s = f
i.w = f
g.x = i
g.z = n
g.s = n
g.p = n
g.t = f
g.y = j
assert i.w.q.w.txt == "f"