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

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

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

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

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

h.s = i
e.r = h
e.w = b
e.v = f
d.v = h
d.q = c
d.z = c
d.r = f
m.y = h
f.s = i
j.v = h
j.r = h
j.q = c
j.z = d
c.v = f
c.r = f
c.q = j
c.z = j
i.y = h
b.y = h
a.r = f
a.v = f
a.w = i
assert c.q.v.s.y.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

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

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

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

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

h.s = i
e.r = h
e.w = b
e.v = f
d.v = h
d.q = c
d.z = c
d.r = f
m.y = h
f.s = i
j.v = h
j.r = h
j.q = c
j.z = d
c.v = f
c.r = f
c.q = j
c.z = j
i.y = h
b.y = h
a.r = f
a.v = f
a.w = i
assert c.q.v.s.y.s.txt == "i"