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

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

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

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

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

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

a = A("a")
f = B("f")
d = C("d")
j = D("j")
i = E("i")
h = F("h")

a.v = h
f.y = j
d.u = f
d.t = f
d.p = h
j.u = f
j.r = f
j.o = h
j.y = a
i.q = a
i.s = a
i.u = j
i.t = j
i.z = h
i.w = h
h.z = a
assert d.t.y.u.y.o.z.txt == "
class A:
    def __init__(self, txt: str):
        self.v: F = None
        self.txt = txt

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

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

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

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

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

a = A("a")
f = B("f")
d = C("d")
j = D("j")
i = E("i")
h = F("h")

a.v = h
f.y = j
d.u = f
d.t = f
d.p = h
j.u = f
j.r = f
j.o = h
j.y = a
i.q = a
i.s = a
i.u = j
i.t = j
i.z = h
i.w = h
h.z = a
assert d.t.y.u.y.o.z.txt == "a"