class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.v: F = None
        self.x: C = None
        self.z: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.s: F = None
        self.p: C = None
        self.r: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.v: F = None
        self.q: C = None
        self.txt = txt

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

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

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

a.o = i
a.v = d
a.x = g
a.z = f
i.x = g
i.p = g
i.s = d
i.r = h
g.u = d
h.v = d
h.q = g
f.r = i
f.t = a
d.s = f
assert h.v.s.r.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.v: F = None
        self.x: C = None
        self.z: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.s: F = None
        self.p: C = None
        self.r: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.v: F = None
        self.q: C = None
        self.txt = txt

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

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

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

a.o = i
a.v = d
a.x = g
a.z = f
i.x = g
i.p = g
i.s = d
i.r = h
g.u = d
h.v = d
h.q = g
f.r = i
f.t = a
d.s = f
assert h.v.s.r.txt == "i"