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

class B:
    def __init__(self, txt: str):
        self.y: B = None
        self.t: A = None
        self.p: B = None
        self.txt = txt

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

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

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

i.u = j
i.w = c
i.r = h
c.y = a
c.p = a
c.t = b
m.s = g
m.z = a
m.u = i
h.o = d
h.v = l
j.s = h
j.z = d
j.u = b
d.y = c
d.p = c
d.t = i
a.y = d
a.t = i
a.p = c
b.u = m
b.w = c
b.r = h
g.o = a
g.v = l
l.o = a
l.v = h
assert d.t.r.v.o.p.t.w.t.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.w: B = None
        self.r: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: B = None
        self.t: A = None
        self.p: B = None
        self.txt = txt

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

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

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

i.u = j
i.w = c
i.r = h
c.y = a
c.p = a
c.t = b
m.s = g
m.z = a
m.u = i
h.o = d
h.v = l
j.s = h
j.z = d
j.u = b
d.y = c
d.p = c
d.t = i
a.y = d
a.t = i
a.p = c
b.u = m
b.w = c
b.r = h
g.o = a
g.v = l
l.o = a
l.v = h
assert d.t.r.v.o.p.t.w.t.u.txt == "m"