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

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

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

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

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

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

c = A("c")
b = B("b")
k = C("k")
a = D("a")
n = E("n")
g = F("g")

c.z = n
c.q = k
b.s = c
k.q = b
k.u = b
a.t = k
a.q = b
a.w = n
a.y = c
n.u = c
n.x = b
g.q = b
g.t = b
assert n.u.z.x.s.q.u.txt == "
class A:
    def __init__(self, txt: str):
        self.z: E = None
        self.q: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

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

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

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

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

c = A("c")
b = B("b")
k = C("k")
a = D("a")
n = E("n")
g = F("g")

c.z = n
c.q = k
b.s = c
k.q = b
k.u = b
a.t = k
a.q = b
a.w = n
a.y = c
n.u = c
n.x = b
g.q = b
g.t = b
assert n.u.z.x.s.q.u.txt == "b"