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

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

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

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

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

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

e.p = k
h.p = j
h.s = m
h.q = i
b.r = m
f.o = m
f.v = k
j.x = f
k.p = l
k.s = m
k.q = f
l.x = f
m.p = k
i.o = e
i.v = h
assert e.p.s.p.q.v.q.o.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

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

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

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

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

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

e.p = k
h.p = j
h.s = m
h.q = i
b.r = m
f.o = m
f.v = k
j.x = f
k.p = l
k.s = m
k.q = f
l.x = f
m.p = k
i.o = e
i.v = h
assert e.p.s.p.q.v.q.o.p.txt == "k"