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

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

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

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

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

f.v = m
f.o = m
k.x = m
m.t = i
i.r = f
i.t = h
i.s = h
h.z = i
assert i.r.v.t.r.v.txt == "m"