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

class B:
    def __init__(self, txt: str):
        self.v: E = None
        self.t: A = None
        self.p: E = None
        self.q: D = None
        self.x: D = None
        self.txt = txt

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

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

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

m = A("m")
h = B("h")
g = C("g")
e = D("e")
f = E("f")
b = B("b")
k = D("k")
a = B("a")
i = C("i")

m.o = k
m.q = b
m.y = g
h.v = f
h.p = f
h.t = m
h.q = k
h.x = e
g.u = i
e.o = m
e.x = m
f.t = i
b.v = f
b.p = f
b.t = m
b.q = e
b.x = k
k.o = m
k.x = m
a.v = f
a.p = f
a.t = m
a.q = k
a.x = k
i.u = g
assert b.x.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.q: B = None
        self.y: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: E = None
        self.t: A = None
        self.p: E = None
        self.q: D = None
        self.x: D = None
        self.txt = txt

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

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

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

m = A("m")
h = B("h")
g = C("g")
e = D("e")
f = E("f")
b = B("b")
k = D("k")
a = B("a")
i = C("i")

m.o = k
m.q = b
m.y = g
h.v = f
h.p = f
h.t = m
h.q = k
h.x = e
g.u = i
e.o = m
e.x = m
f.t = i
b.v = f
b.p = f
b.t = m
b.q = e
b.x = k
k.o = m
k.x = m
a.v = f
a.p = f
a.t = m
a.q = k
a.x = k
i.u = g
assert b.x.o.o.txt == "k"