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

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

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

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

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

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

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

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

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

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

l.u = c
l.q = c
l.v = i
l.o = g
g.x = c
g.w = i
g.y = l
b.r = i
b.x = i
b.q = c
j.t = b
j.x = b
m.u = e
m.v = b
m.o = n
m.q = j
c.t = i
c.x = b
e.t = i
e.x = b
h.x = e
h.w = b
h.y = l
i.r = b
i.x = b
i.q = c
n.x = j
n.w = b
n.y = m
assert l.o.x.t.r.x.r.r.txt == "i"