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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: F = None
        self.txt = txt

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

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

a.s = g
g.q = d
g.r = d
g.t = k
g.v = a
g.u = b
c.z = k
c.y = b
c.o = g
b.y = c
b.w = c
b.z = c
d.u = k
k.r = g
assert c.z.r.q.u.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: F = None
        self.txt = txt

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

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

a.s = g
g.q = d
g.r = d
g.t = k
g.v = a
g.u = b
c.z = k
c.y = b
c.o = g
b.y = c
b.w = c
b.z = c
d.u = k
k.r = g
assert c.z.r.q.u.txt == "k"