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

class B:
    def __init__(self, txt: str):
        self.o: B = None
        self.t: B = None
        self.w: B = None
        self.txt = txt

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

j = A("j")
a = B("a")
d = C("d")
l = C("l")
h = B("h")
k = B("k")
b = B("b")
m = A("m")
n = C("n")

j.p = b
j.q = m
j.r = h
a.o = b
a.w = b
a.t = k
d.t = l
d.z = b
d.x = n
l.t = n
l.z = h
l.x = d
h.o = a
h.w = a
h.t = k
k.o = b
k.t = h
k.w = h
b.o = k
b.w = k
b.t = a
m.p = h
m.q = j
m.r = k
n.t = l
n.z = h
n.x = d
assert a.w.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.q: A = None
        self.r: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: B = None
        self.t: B = None
        self.w: B = None
        self.txt = txt

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

j = A("j")
a = B("a")
d = C("d")
l = C("l")
h = B("h")
k = B("k")
b = B("b")
m = A("m")
n = C("n")

j.p = b
j.q = m
j.r = h
a.o = b
a.w = b
a.t = k
d.t = l
d.z = b
d.x = n
l.t = n
l.z = h
l.x = d
h.o = a
h.w = a
h.t = k
k.o = b
k.t = h
k.w = h
b.o = k
b.w = k
b.t = a
m.p = h
m.q = j
m.r = k
n.t = l
n.z = h
n.x = d
assert a.w.w.w.txt == "h"