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

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

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

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

h = A("h")
g = B("g")
k = C("k")
c = D("c")
b = C("b")
l = B("l")
j = A("j")
d = D("d")

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

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

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

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

h = A("h")
g = B("g")
k = C("k")
c = D("c")
b = C("b")
l = B("l")
j = A("j")
d = D("d")

h.s = l
h.y = l
h.t = d
g.o = l
k.z = j
k.w = h
k.q = b
c.v = d
c.w = j
c.u = h
c.o = k
b.z = j
b.w = j
b.q = k
l.o = g
j.s = l
j.y = l
j.t = c
d.v = c
d.w = j
d.u = h
d.o = k
assert k.z.t.w.y.txt == "l"