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

class B:
    def __init__(self, txt: str):
        self.t: D = None
        self.q: B = None
        self.u: A = None
        self.v: D = None
        self.txt = txt

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

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

g = A("g")
l = B("l")
h = C("h")
e = D("e")
a = B("a")
j = B("j")
c = D("c")

g.s = c
l.t = e
l.q = a
l.u = g
l.v = c
h.q = a
e.r = a
e.w = a
e.x = g
e.s = g
a.t = c
a.q = l
a.u = g
a.v = e
j.t = e
j.v = e
j.q = a
j.u = g
c.r = j
c.x = g
c.s = g
c.w = a
assert h.q.v.r.u.s.r.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: D = None
        self.q: B = None
        self.u: A = None
        self.v: D = None
        self.txt = txt

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

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

g = A("g")
l = B("l")
h = C("h")
e = D("e")
a = B("a")
j = B("j")
c = D("c")

g.s = c
l.t = e
l.q = a
l.u = g
l.v = c
h.q = a
e.r = a
e.w = a
e.x = g
e.s = g
a.t = c
a.q = l
a.u = g
a.v = e
j.t = e
j.v = e
j.q = a
j.u = g
c.r = j
c.x = g
c.s = g
c.w = a
assert h.q.v.r.u.s.r.txt == "j"