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

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

l = A("l")
c = B("c")
h = A("h")
a = B("a")
k = A("k")
g = A("g")
m = A("m")
i = A("i")
e = A("e")

l.z = a
l.p = c
c.x = a
c.p = l
h.z = c
h.p = a
a.x = c
a.p = h
k.z = a
k.p = a
g.z = c
g.p = c
m.z = c
m.p = c
i.z = a
i.p = a
e.z = c
e.p = c
assert i.z.x.x.x.p.p.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.p: B = None
        self.txt = txt

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

l = A("l")
c = B("c")
h = A("h")
a = B("a")
k = A("k")
g = A("g")
m = A("m")
i = A("i")
e = A("e")

l.z = a
l.p = c
c.x = a
c.p = l
h.z = c
h.p = a
a.x = c
a.p = h
k.z = a
k.p = a
g.z = c
g.p = c
m.z = c
m.p = c
i.z = a
i.p = a
e.z = c
e.p = c
assert i.z.x.x.x.p.p.txt == "c"