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

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

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

class D:
    def __init__(self, txt: str):
        self.r: A = None
        self.u: A = None
        self.p: E = None
        self.txt = txt

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

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

k = A("k")
e = B("e")
f = C("f")
a = D("a")
i = E("i")
h = F("h")

k.y = i
k.o = i
k.u = e
k.z = a
e.r = f
e.q = k
e.w = a
f.p = i
a.r = k
a.u = k
a.p = i
i.y = e
h.y = i
h.p = a
assert a.r.z.r.txt == "
class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.o: E = None
        self.u: B = None
        self.z: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.r: A = None
        self.u: A = None
        self.p: E = None
        self.txt = txt

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

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

k = A("k")
e = B("e")
f = C("f")
a = D("a")
i = E("i")
h = F("h")

k.y = i
k.o = i
k.u = e
k.z = a
e.r = f
e.q = k
e.w = a
f.p = i
a.r = k
a.u = k
a.p = i
i.y = e
h.y = i
h.p = a
assert a.r.z.r.txt == "k"