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

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

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

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

i.o = h
i.y = h
e.x = m
f.q = c
m.x = n
c.q = f
h.x = e
k.o = g
k.y = e
a.o = m
a.y = h
n.x = e
g.x = m
assert e.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.y: B = None
        self.txt = txt

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

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

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

i.o = h
i.y = h
e.x = m
f.q = c
m.x = n
c.q = f
h.x = e
k.o = g
k.y = e
a.o = m
a.y = h
n.x = e
g.x = m
assert e.x.x.x.txt == "e"