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

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

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

g = A("g")
n = B("n")
h = C("h")
e = A("e")
b = A("b")
d = B("d")
j = C("j")

g.x = b
g.o = b
g.y = j
n.o = e
n.s = e
n.y = d
h.s = g
h.w = g
h.x = g
e.x = b
e.o = g
e.y = h
b.x = e
b.o = e
b.y = h
d.o = g
d.s = b
d.y = n
j.s = g
j.w = b
j.x = e
assert j.x.o.y.s.y.s.y.txt == "
class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.o: A = None
        self.y: C = None
        self.txt = txt

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

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

g = A("g")
n = B("n")
h = C("h")
e = A("e")
b = A("b")
d = B("d")
j = C("j")

g.x = b
g.o = b
g.y = j
n.o = e
n.s = e
n.y = d
h.s = g
h.w = g
h.x = g
e.x = b
e.o = g
e.y = h
b.x = e
b.o = e
b.y = h
d.o = g
d.s = b
d.y = n
j.s = g
j.w = b
j.x = e
assert j.x.o.y.s.y.s.y.txt == "j"