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

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

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

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

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

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

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

c.r = g
b.u = f
b.z = f
b.p = k
f.t = g
f.u = b
f.z = e
f.r = c
f.s = c
k.q = c
k.w = f
e.w = c
e.s = f
e.r = f
e.t = k
g.z = e
g.y = b
g.s = b
g.q = b
g.x = c
g.p = k
assert c.r.x.r.s.p.q.txt == "
class A:
    def __init__(self, txt: str):
        self.r: F = None
        self.txt = txt

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

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

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

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

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

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

c.r = g
b.u = f
b.z = f
b.p = k
f.t = g
f.u = b
f.z = e
f.r = c
f.s = c
k.q = c
k.w = f
e.w = c
e.s = f
e.r = f
e.t = k
g.z = e
g.y = b
g.s = b
g.q = b
g.x = c
g.p = k
assert c.r.x.r.s.p.q.txt == "c"