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

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

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

l = A("l")
e = B("e")
h = C("h")
b = A("b")
g = B("g")
n = A("n")
i = C("i")
c = A("c")
m = B("m")
a = A("a")

l.y = h
l.q = i
l.t = e
e.w = h
e.x = h
h.x = i
h.r = e
b.y = i
b.q = h
b.t = g
g.w = i
g.x = h
n.y = h
n.q = i
n.t = m
i.x = h
i.r = m
c.y = i
c.q = i
c.t = e
m.w = h
m.x = h
a.y = h
a.q = i
a.t = m
assert e.w.x.r.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.q: C = None
        self.t: B = None
        self.txt = txt

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

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

l = A("l")
e = B("e")
h = C("h")
b = A("b")
g = B("g")
n = A("n")
i = C("i")
c = A("c")
m = B("m")
a = A("a")

l.y = h
l.q = i
l.t = e
e.w = h
e.x = h
h.x = i
h.r = e
b.y = i
b.q = h
b.t = g
g.w = i
g.x = h
n.y = h
n.q = i
n.t = m
i.x = h
i.r = m
c.y = i
c.q = i
c.t = e
m.w = h
m.x = h
a.y = h
a.q = i
a.t = m
assert e.w.x.r.txt == "m"