class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: A = None
        self.v: E = None
        self.o: B = None
        self.p: F = None
        self.y: B = None
        self.s: B = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.s: E = None
        self.p: E = None
        self.q: D = None
        self.z: C = None
        self.t: C = None
        self.txt = txt

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

i.y = k
h.x = f
k.r = i
k.v = m
k.o = h
k.y = h
k.s = h
k.p = a
f.v = i
f.z = m
m.y = k
m.w = i
a.s = m
a.p = m
a.q = f
a.z = k
a.t = k
assert m.y.r.y.y.x.v.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: A = None
        self.v: E = None
        self.o: B = None
        self.p: F = None
        self.y: B = None
        self.s: B = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.s: E = None
        self.p: E = None
        self.q: D = None
        self.z: C = None
        self.t: C = None
        self.txt = txt

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

i.y = k
h.x = f
k.r = i
k.v = m
k.o = h
k.y = h
k.s = h
k.p = a
f.v = i
f.z = m
m.y = k
m.w = i
a.s = m
a.p = m
a.q = f
a.z = k
a.t = k
assert m.y.r.y.y.x.v.txt == "i"