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

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

class C:
    def __init__(self, txt: str):
        self.o: A = None
        self.u: B = None
        self.y: B = None
        self.txt = txt

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

g = A("g")
f = B("f")
m = C("m")
j = D("j")
k = B("k")
e = D("e")
a = B("a")
d = C("d")
l = C("l")
c = B("c")

g.v = a
f.v = j
f.r = e
m.o = g
m.u = k
m.y = c
j.q = a
j.o = l
k.v = e
k.r = j
e.q = f
e.o = l
a.v = e
a.r = e
d.o = g
d.u = c
d.y = f
l.o = g
l.u = c
l.y = a
c.v = e
c.r = j
assert d.o.v.v.o.y.v.q.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.o: A = None
        self.u: B = None
        self.y: B = None
        self.txt = txt

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

g = A("g")
f = B("f")
m = C("m")
j = D("j")
k = B("k")
e = D("e")
a = B("a")
d = C("d")
l = C("l")
c = B("c")

g.v = a
f.v = j
f.r = e
m.o = g
m.u = k
m.y = c
j.q = a
j.o = l
k.v = e
k.r = j
e.q = f
e.o = l
a.v = e
a.r = e
d.o = g
d.u = c
d.y = f
l.o = g
l.u = c
l.y = a
c.v = e
c.r = j
assert d.o.v.v.o.y.v.q.txt == "f"