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

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

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

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

e = A("e")
a = B("a")
g = C("g")
l = D("l")
m = B("m")
d = A("d")
f = D("f")

e.t = m
e.r = f
e.s = l
a.q = g
a.w = g
a.o = g
g.s = f
l.x = e
l.y = d
m.q = g
m.w = g
m.o = g
d.t = m
d.r = f
d.s = l
f.x = e
f.y = e
assert m.q.s.x.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.r: D = None
        self.s: D = None
        self.txt = txt

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

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

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

e = A("e")
a = B("a")
g = C("g")
l = D("l")
m = B("m")
d = A("d")
f = D("f")

e.t = m
e.r = f
e.s = l
a.q = g
a.w = g
a.o = g
g.s = f
l.x = e
l.y = d
m.q = g
m.w = g
m.o = g
d.t = m
d.r = f
d.s = l
f.x = e
f.y = e
assert m.q.s.x.txt == "e"