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

class B:
    def __init__(self, txt: str):
        self.u: B = None
        self.w: C = None
        self.r: B = None
        self.txt = txt

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

c = A("c")
e = B("e")
l = C("l")
b = B("b")
g = B("g")
h = A("h")
i = B("i")
n = B("n")
f = C("f")

c.o = h
c.p = h
e.u = i
e.w = l
e.r = b
l.q = h
l.w = f
l.p = n
b.u = i
b.w = f
b.r = e
g.u = i
g.w = l
g.r = e
h.o = c
h.p = c
i.u = n
i.w = l
i.r = e
n.u = i
n.r = i
n.w = l
f.q = c
f.w = l
f.p = g
assert l.q.p.p.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.p: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: B = None
        self.w: C = None
        self.r: B = None
        self.txt = txt

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

c = A("c")
e = B("e")
l = C("l")
b = B("b")
g = B("g")
h = A("h")
i = B("i")
n = B("n")
f = C("f")

c.o = h
c.p = h
e.u = i
e.w = l
e.r = b
l.q = h
l.w = f
l.p = n
b.u = i
b.w = f
b.r = e
g.u = i
g.w = l
g.r = e
h.o = c
h.p = c
i.u = n
i.w = l
i.r = e
n.u = i
n.r = i
n.w = l
f.q = c
f.w = l
f.p = g
assert l.q.p.p.o.txt == "c"