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

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

e = A("e")
i = B("i")
j = A("j")
l = A("l")
m = A("m")
c = A("c")
n = B("n")
a = B("a")

e.y = a
e.t = i
i.x = m
i.p = c
j.y = a
j.t = i
l.y = a
l.t = a
m.y = i
m.t = n
c.y = i
c.t = a
n.x = c
n.p = m
a.x = c
a.p = l
assert i.x.t.p.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.t: B = None
        self.txt = txt

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

e = A("e")
i = B("i")
j = A("j")
l = A("l")
m = A("m")
c = A("c")
n = B("n")
a = B("a")

e.y = a
e.t = i
i.x = m
i.p = c
j.y = a
j.t = i
l.y = a
l.t = a
m.y = i
m.t = n
c.y = i
c.t = a
n.x = c
n.p = m
a.x = c
a.p = l
assert i.x.t.p.txt == "m"