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

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

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

g = A("g")
i = B("i")
l = C("l")
k = A("k")
j = C("j")
e = C("e")
m = B("m")
c = A("c")

g.p = l
g.v = m
i.q = m
i.v = k
i.u = g
l.x = j
l.p = c
l.o = c
k.p = j
k.v = m
j.x = l
j.p = k
j.o = k
e.x = l
e.p = c
e.o = g
m.q = i
m.v = g
m.u = g
c.p = e
c.v = i
assert e.p.p.o.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.v: B = None
        self.txt = txt

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

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

g = A("g")
i = B("i")
l = C("l")
k = A("k")
j = C("j")
e = C("e")
m = B("m")
c = A("c")

g.p = l
g.v = m
i.q = m
i.v = k
i.u = g
l.x = j
l.p = c
l.o = c
k.p = j
k.v = m
j.x = l
j.p = k
j.o = k
e.x = l
e.p = c
e.o = g
m.q = i
m.v = g
m.u = g
c.p = e
c.v = i
assert e.p.p.o.p.txt == "l"