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

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.x: D = None
        self.txt = txt

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

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

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

e.t = g
e.y = k
e.p = j
e.v = c
b.z = m
b.x = j
f.t = j
f.v = g
f.w = h
j.p = g
j.y = b
j.u = k
j.v = e
k.z = j
k.x = j
c.z = m
c.x = m
m.p = h
m.y = c
m.u = k
m.v = e
h.t = g
h.y = c
h.v = c
h.p = j
g.t = h
g.y = c
g.p = j
g.v = b
n.t = m
n.v = e
n.w = e
assert b.z.p.v.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.y: B = None
        self.p: D = None
        self.v: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.x: D = None
        self.txt = txt

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

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

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

e.t = g
e.y = k
e.p = j
e.v = c
b.z = m
b.x = j
f.t = j
f.v = g
f.w = h
j.p = g
j.y = b
j.u = k
j.v = e
k.z = j
k.x = j
c.z = m
c.x = m
m.p = h
m.y = c
m.u = k
m.v = e
h.t = g
h.y = c
h.v = c
h.p = j
g.t = h
g.y = c
g.p = j
g.v = b
n.t = m
n.v = e
n.w = e
assert b.z.p.v.txt == "c"