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

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

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

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

c = A("c")
i = B("i")
m = C("m")
d = D("d")
g = A("g")
l = D("l")
e = C("e")
h = B("h")
a = D("a")

c.v = g
c.u = g
i.t = m
i.q = h
i.w = c
m.u = h
d.q = m
d.t = m
d.v = i
g.v = c
g.u = c
l.q = e
l.t = m
l.v = i
e.u = h
h.t = m
h.q = i
h.w = g
a.q = e
a.t = e
a.v = i
assert d.q.u.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.u: A = None
        self.txt = txt

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

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

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

c = A("c")
i = B("i")
m = C("m")
d = D("d")
g = A("g")
l = D("l")
e = C("e")
h = B("h")
a = D("a")

c.v = g
c.u = g
i.t = m
i.q = h
i.w = c
m.u = h
d.q = m
d.t = m
d.v = i
g.v = c
g.u = c
l.q = e
l.t = m
l.v = i
e.u = h
h.t = m
h.q = i
h.w = g
a.q = e
a.t = e
a.v = i
assert d.q.u.q.q.txt == "h"