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

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

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

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

b.o = j
b.r = f
b.w = f
h.p = f
h.t = g
h.x = c
i.z = n
c.z = j
n.o = j
n.r = h
n.w = f
f.p = h
f.t = g
f.x = c
j.o = g
j.r = h
j.w = h
g.o = b
g.r = f
g.w = h
assert c.z.r.x.z.r.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.r: B = None
        self.w: B = None
        self.txt = txt

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

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

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

b.o = j
b.r = f
b.w = f
h.p = f
h.t = g
h.x = c
i.z = n
c.z = j
n.o = j
n.r = h
n.w = f
f.p = h
f.t = g
f.x = c
j.o = g
j.r = h
j.w = h
g.o = b
g.r = f
g.w = h
assert c.z.r.x.z.r.txt == "h"