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

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

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

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

i = A("i")
h = B("h")
c = C("c")
g = D("g")
k = B("k")
b = D("b")
m = B("m")
j = A("j")
n = C("n")
f = A("f")

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

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

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

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

i = A("i")
h = B("h")
c = C("c")
g = D("g")
k = B("k")
b = D("b")
m = B("m")
j = A("j")
n = C("n")
f = A("f")

i.s = c
i.u = g
h.v = k
h.s = c
h.y = g
h.p = n
c.p = f
c.r = b
c.o = h
g.r = j
g.t = f
k.v = h
k.s = c
k.p = c
k.y = g
b.r = f
b.t = f
m.v = h
m.s = c
m.y = b
m.p = n
j.s = n
j.u = b
n.p = j
n.r = g
n.o = k
f.s = c
f.u = g
assert n.p.s.o.v.txt == "h"