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

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

class C:
    def __init__(self, txt: str):
        self.v: F = None
        self.x: E = None
        self.o: D = None
        self.y: E = None
        self.txt = txt

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

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

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

k = A("k")
f = B("f")
m = C("m")
n = D("n")
c = E("c")
b = F("b")

k.t = f
k.r = f
k.u = m
k.s = m
k.w = c
f.r = b
f.x = k
m.v = b
m.x = c
m.y = c
m.o = n
n.y = c
c.q = b
b.s = c
b.r = m
b.u = k
assert b.r.v.r.o.y.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.u: C = None
        self.s: C = None
        self.r: B = None
        self.w: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: F = None
        self.x: E = None
        self.o: D = None
        self.y: E = None
        self.txt = txt

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

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

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

k = A("k")
f = B("f")
m = C("m")
n = D("n")
c = E("c")
b = F("b")

k.t = f
k.r = f
k.u = m
k.s = m
k.w = c
f.r = b
f.x = k
m.v = b
m.x = c
m.y = c
m.o = n
n.y = c
c.q = b
b.s = c
b.r = m
b.u = k
assert b.r.v.r.o.y.txt == "c"