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

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

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

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

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

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

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

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

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

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

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

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

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

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

c.u = e
c.z = l
e.s = l
e.o = l
e.q = a
e.r = k
a.z = k
a.w = g
k.q = c
k.r = g
l.w = a
l.r = a
g.r = e
b.q = c
b.r = g
assert l.w.z.q.z.r.txt == "a"