class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.o: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: E = None
        self.t: E = None
        self.u: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: E = None
        self.o: F = None
        self.s: E = None
        self.p: B = None
        self.q: E = None
        self.x: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: B = None
        self.s: B = None
        self.p: D = None
        self.txt = txt

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

c = A("c")
i = B("i")
h = C("h")
e = D("e")
n = E("n")
g = F("g")

c.w = i
c.o = e
i.y = c
i.q = e
i.z = g
h.q = n
h.t = n
h.u = c
e.r = n
e.s = n
e.q = n
e.o = g
e.p = i
e.x = h
n.o = i
n.s = i
n.p = e
g.v = i
assert c.w.y.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.o: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: E = None
        self.t: E = None
        self.u: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: E = None
        self.o: F = None
        self.s: E = None
        self.p: B = None
        self.q: E = None
        self.x: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: B = None
        self.s: B = None
        self.p: D = None
        self.txt = txt

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

c = A("c")
i = B("i")
h = C("h")
e = D("e")
n = E("n")
g = F("g")

c.w = i
c.o = e
i.y = c
i.q = e
i.z = g
h.q = n
h.t = n
h.u = c
e.r = n
e.s = n
e.q = n
e.o = g
e.p = i
e.x = h
n.o = i
n.s = i
n.p = e
g.v = i
assert c.w.y.w.txt == "i"