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

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

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

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

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

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

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

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

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

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

j.v = c
j.r = g
j.o = h
l.t = g
l.y = c
l.s = j
n.y = c
n.p = c
c.o = b
c.t = j
c.v = m
c.y = n
h.t = j
h.y = c
h.s = g
g.v = c
g.r = j
g.o = h
m.y = c
m.p = c
b.y = c
b.p = c
assert g.r.v.y.p.v.txt == "m"