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

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

class C:
    def __init__(self, txt: str):
        self.r: C = None
        self.o: D = None
        self.t: D = None
        self.u: B = None
        self.q: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.t: E = None
        self.x: C = None
        self.r: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: A = None
        self.u: A = None
        self.txt = txt

g = A("g")
e = B("e")
j = C("j")
h = D("h")
d = E("d")
l = C("l")

g.s = e
e.y = h
e.x = h
j.r = l
j.o = h
j.t = h
j.u = e
j.q = e
h.q = g
h.t = d
h.r = d
h.x = j
d.v = g
d.u = g
l.r = j
l.o = h
l.t = h
l.u = e
l.q = e
assert e.y.x.r.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: C = None
        self.o: D = None
        self.t: D = None
        self.u: B = None
        self.q: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.t: E = None
        self.x: C = None
        self.r: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: A = None
        self.u: A = None
        self.txt = txt

g = A("g")
e = B("e")
j = C("j")
h = D("h")
d = E("d")
l = C("l")

g.s = e
e.y = h
e.x = h
j.r = l
j.o = h
j.t = h
j.u = e
j.q = e
h.q = g
h.t = d
h.r = d
h.x = j
d.v = g
d.u = g
l.r = j
l.o = h
l.t = h
l.u = e
l.q = e
assert e.y.x.r.txt == "l"