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

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

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

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

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

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

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

b.v = h
b.p = i
m.u = h
i.o = h
i.r = n
n.x = h
d.u = m
d.y = h
d.v = i
d.s = i
d.z = b
h.r = m
assert i.o.r.u.txt == "
class A:
    def __init__(self, txt: str):
        self.v: F = None
        self.p: C = None
        self.txt = txt

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

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

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

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

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

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

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