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

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

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

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

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

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

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

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

e.p = a
e.s = l
e.x = h
a.p = h
f.q = g
f.x = l
k.q = g
k.x = l
i.q = h
i.x = e
h.p = g
c.q = h
c.x = e
l.p = a
l.x = a
l.s = e
g.p = h
assert e.x.p.p.p.p.txt == "h"