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

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

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

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

b.o = g
b.u = g
b.t = i
n.z = b
k.z = b
k.r = g
g.o = b
g.u = b
g.t = j
j.z = g
i.z = g
h.z = g
h.r = b
assert g.t.z.t.z.o.u.t.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.u: A = None
        self.t: B = None
        self.txt = txt

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

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

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

b.o = g
b.u = g
b.t = i
n.z = b
k.z = b
k.r = g
g.o = b
g.u = b
g.t = j
j.z = g
i.z = g
h.z = g
h.r = b
assert g.t.z.t.z.o.u.t.txt == "j"