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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: B = None
        self.r: D = None
        self.t: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: A = None
        self.o: B = None
        self.q: B = None
        self.w: B = None
        self.z: E = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: B = None
        self.r: D = None
        self.t: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: A = None
        self.o: B = None
        self.q: B = None
        self.w: B = None
        self.z: E = None
        self.txt = txt

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

e.x = c
e.y = i
e.q = i
i.u = c
i.r = c
i.t = g
c.w = e
n.y = a
g.q = i
g.r = n
g.t = a
a.t = e
a.o = i
a.q = i
a.w = i
a.z = g
assert a.o.u.w.q.txt == "i"