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

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

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

class D:
    def __init__(self, txt: str):
        self.t: B = None
        self.r: B = 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.z: B = None
        self.txt = txt

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

j.z = k
j.y = k
j.u = f
j.o = f
j.r = m
m.t = j
b.v = k
n.t = m
n.r = m
k.q = f
f.z = m
assert m.t.r.t.txt == "
class A:
    def __init__(self, txt: str):
        self.z: E = None
        self.u: F = None
        self.r: B = None
        self.o: F = None
        self.y: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.t: B = None
        self.r: B = 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.z: B = None
        self.txt = txt

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

j.z = k
j.y = k
j.u = f
j.o = f
j.r = m
m.t = j
b.v = k
n.t = m
n.r = m
k.q = f
f.z = m
assert m.t.r.t.txt == "j"