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

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

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

class D:
    def __init__(self, txt: str):
        self.u: C = None
        self.p: C = None
        self.w: A = None
        self.v: C = None
        self.txt = txt

j = A("j")
c = B("c")
l = C("l")
e = D("e")
h = C("h")
i = C("i")
a = C("a")
b = C("b")
m = D("m")

j.r = b
c.q = b
l.t = m
l.x = c
l.w = c
e.u = h
e.p = h
e.v = h
e.w = j
h.t = m
h.x = c
h.w = c
i.t = m
i.x = c
i.w = c
a.t = e
a.x = c
a.w = c
b.t = e
b.x = c
b.w = c
m.u = l
m.p = h
m.v = h
m.w = j
assert c.q.x.q.x.q.x.q.t.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: C = None
        self.p: C = None
        self.w: A = None
        self.v: C = None
        self.txt = txt

j = A("j")
c = B("c")
l = C("l")
e = D("e")
h = C("h")
i = C("i")
a = C("a")
b = C("b")
m = D("m")

j.r = b
c.q = b
l.t = m
l.x = c
l.w = c
e.u = h
e.p = h
e.v = h
e.w = j
h.t = m
h.x = c
h.w = c
i.t = m
i.x = c
i.w = c
a.t = e
a.x = c
a.w = c
b.t = e
b.x = c
b.w = c
m.u = l
m.p = h
m.v = h
m.w = j
assert c.q.x.q.x.q.x.q.t.txt == "e"