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

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

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

h = A("h")
n = B("n")
m = C("m")
c = B("c")
a = B("a")
g = C("g")
l = A("l")
j = B("j")

h.x = a
h.w = m
h.p = l
n.o = j
n.q = l
n.p = h
m.t = h
m.p = j
m.u = g
c.o = a
c.q = h
c.p = l
a.o = j
a.q = l
a.p = l
g.t = l
g.p = j
g.u = m
l.x = a
l.w = g
l.p = h
j.o = c
j.q = l
j.p = l
assert c.q.w.p.q.x.q.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.w: C = None
        self.p: A = None
        self.txt = txt

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

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

h = A("h")
n = B("n")
m = C("m")
c = B("c")
a = B("a")
g = C("g")
l = A("l")
j = B("j")

h.x = a
h.w = m
h.p = l
n.o = j
n.q = l
n.p = h
m.t = h
m.p = j
m.u = g
c.o = a
c.q = h
c.p = l
a.o = j
a.q = l
a.p = l
g.t = l
g.p = j
g.u = m
l.x = a
l.w = g
l.p = h
j.o = c
j.q = l
j.p = l
assert c.q.w.p.q.x.q.txt == "l"