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

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

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

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

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

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

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

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

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

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

h.v = c
h.r = g
l.p = h
l.z = h
l.w = b
l.r = g
c.y = h
c.v = h
c.q = m
g.w = e
g.o = b
g.q = i
i.w = e
i.o = b
i.q = g
b.p = h
b.z = h
b.w = l
b.r = i
m.y = h
m.v = h
m.q = c
e.y = h
e.v = h
e.q = m
assert g.q.w.v.v.txt == "c"