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

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

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

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

l = A("l")
h = B("h")
g = C("g")
j = D("j")
b = A("b")
f = D("f")
m = B("m")

l.t = b
l.v = j
h.o = l
h.t = l
h.v = b
h.s = m
g.z = m
g.r = h
g.o = f
g.u = f
j.w = l
b.t = l
b.v = f
f.w = l
m.o = b
m.t = b
m.v = b
m.s = h
assert g.u.w.v.w.v.w.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.v: D = None
        self.txt = txt

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

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

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

l = A("l")
h = B("h")
g = C("g")
j = D("j")
b = A("b")
f = D("f")
m = B("m")

l.t = b
l.v = j
h.o = l
h.t = l
h.v = b
h.s = m
g.z = m
g.r = h
g.o = f
g.u = f
j.w = l
b.t = l
b.v = f
f.w = l
m.o = b
m.t = b
m.v = b
m.s = h
assert g.u.w.v.w.v.w.t.txt == "b"