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

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

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

m = A("m")
j = B("j")
e = C("e")
a = A("a")
k = B("k")
h = C("h")
g = C("g")
c = A("c")

m.o = j
m.r = k
m.u = k
j.w = c
j.x = k
e.r = k
e.q = h
e.p = h
a.o = j
a.r = j
a.u = k
k.w = a
k.x = j
h.r = j
h.q = g
h.p = e
g.r = k
g.q = h
g.p = h
c.o = k
c.r = j
c.u = j
assert e.r.x.x.w.r.w.r.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.r: B = None
        self.u: B = None
        self.txt = txt

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

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

m = A("m")
j = B("j")
e = C("e")
a = A("a")
k = B("k")
h = C("h")
g = C("g")
c = A("c")

m.o = j
m.r = k
m.u = k
j.w = c
j.x = k
e.r = k
e.q = h
e.p = h
a.o = j
a.r = j
a.u = k
k.w = a
k.x = j
h.r = j
h.q = g
h.p = e
g.r = k
g.q = h
g.p = h
c.o = k
c.r = j
c.u = j
assert e.r.x.x.w.r.w.r.txt == "j"