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

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

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

h = A("h")
d = B("d")
f = C("f")
j = B("j")
k = A("k")
l = A("l")
n = B("n")
i = B("i")
b = C("b")

h.t = f
h.o = f
h.p = j
d.w = i
d.x = h
f.t = k
f.v = k
f.y = j
j.w = i
j.x = h
k.t = b
k.p = d
k.o = f
l.t = f
l.p = n
l.o = b
n.w = d
n.x = k
i.w = j
i.x = h
b.t = k
b.y = i
b.v = h
assert i.x.p.x.t.v.t.y.w.x.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.p: B = None
        self.o: C = None
        self.txt = txt

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

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

h = A("h")
d = B("d")
f = C("f")
j = B("j")
k = A("k")
l = A("l")
n = B("n")
i = B("i")
b = C("b")

h.t = f
h.o = f
h.p = j
d.w = i
d.x = h
f.t = k
f.v = k
f.y = j
j.w = i
j.x = h
k.t = b
k.p = d
k.o = f
l.t = f
l.p = n
l.o = b
n.w = d
n.x = k
i.w = j
i.x = h
b.t = k
b.y = i
b.v = h
assert i.x.p.x.t.v.t.y.w.x.txt == "h"