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

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

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

k = A("k")
b = B("b")
c = C("c")
j = B("j")
n = A("n")
d = A("d")
l = B("l")

k.x = c
k.z = d
k.v = d
b.o = j
b.q = l
b.p = c
c.z = k
c.p = j
j.o = b
j.q = l
j.p = c
n.x = c
n.z = k
n.v = k
d.x = c
d.z = k
d.v = n
l.o = b
l.q = b
l.p = c
assert l.q.o.p.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.z: A = None
        self.v: A = None
        self.txt = txt

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

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

k = A("k")
b = B("b")
c = C("c")
j = B("j")
n = A("n")
d = A("d")
l = B("l")

k.x = c
k.z = d
k.v = d
b.o = j
b.q = l
b.p = c
c.z = k
c.p = j
j.o = b
j.q = l
j.p = c
n.x = c
n.z = k
n.v = k
d.x = c
d.z = k
d.v = n
l.o = b
l.q = b
l.p = c
assert l.q.o.p.txt == "c"