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

class B:
    def __init__(self, txt: str):
        self.w: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: E = None
        self.p: E = None
        self.v: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.y: A = None
        self.txt = txt

m = A("m")
i = B("i")
d = C("d")
b = D("b")
j = E("j")
g = C("g")
f = C("f")
h = C("h")

m.o = h
m.q = i
m.v = i
i.w = m
d.w = j
d.p = j
d.v = b
b.y = j
b.t = f
j.y = m
g.w = j
g.p = j
g.v = b
f.w = j
f.p = j
f.v = b
h.w = j
h.p = j
h.v = b
assert h.v.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.q: B = None
        self.v: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: E = None
        self.p: E = None
        self.v: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.y: A = None
        self.txt = txt

m = A("m")
i = B("i")
d = C("d")
b = D("b")
j = E("j")
g = C("g")
f = C("f")
h = C("h")

m.o = h
m.q = i
m.v = i
i.w = m
d.w = j
d.p = j
d.v = b
b.y = j
b.t = f
j.y = m
g.w = j
g.p = j
g.v = b
f.w = j
f.p = j
f.v = b
h.w = j
h.p = j
h.v = b
assert h.v.y.y.txt == "m"