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

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

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

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

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

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

h = A("h")
m = B("m")
d = C("d")
n = D("n")
a = E("a")
b = F("b")
i = F("i")

h.s = m
h.x = m
h.v = n
m.x = b
m.u = n
m.y = i
m.z = h
d.s = a
n.y = i
n.s = h
n.t = m
a.u = n
b.o = i
i.o = b
assert h.v.t.x.o.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.x: B = None
        self.v: D = None
        self.txt = txt

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

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

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

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

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

h = A("h")
m = B("m")
d = C("d")
n = D("n")
a = E("a")
b = F("b")
i = F("i")

h.s = m
h.x = m
h.v = n
m.x = b
m.u = n
m.y = i
m.z = h
d.s = a
n.y = i
n.s = h
n.t = m
a.u = n
b.o = i
i.o = b
assert h.v.t.x.o.txt == "i"