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

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

class C:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

i = A("i")
h = B("h")
c = C("c")
f = B("f")
m = C("m")
n = B("n")
e = B("e")

i.t = n
h.x = n
h.o = f
c.s = e
f.x = n
f.o = n
m.s = h
n.x = e
n.o = h
e.x = h
e.o = h
assert c.s.o.x.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

i = A("i")
h = B("h")
c = C("c")
f = B("f")
m = C("m")
n = B("n")
e = B("e")

i.t = n
h.x = n
h.o = f
c.s = e
f.x = n
f.o = n
m.s = h
n.x = e
n.o = h
e.x = h
e.o = h
assert c.s.o.x.txt == "n"