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

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

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

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

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

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

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

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

j.y = c
j.z = c
j.p = l
m.q = j
m.z = j
m.o = n
g.t = j
g.y = h
c.t = j
c.y = j
n.t = h
n.y = j
h.y = c
h.z = n
h.p = l
l.q = h
l.o = g
l.z = j
assert c.y.p.q.txt == "h"