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

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

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

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

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

j.p = e
j.r = b
j.v = k
m.q = b
m.o = c
m.v = f
e.w = h
e.r = m
e.q = i
h.t = e
h.z = e
h.x = j
h.w = c
b.p = e
b.r = j
b.v = f
c.w = i
c.r = m
c.q = h
k.w = n
k.q = n
k.r = m
n.t = f
n.z = f
n.x = b
n.w = c
f.w = n
f.q = n
f.r = m
i.t = k
i.w = k
i.z = e
i.x = j
assert c.q.w.w.w.q.x.v.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.r: A = None
        self.v: C = None
        self.txt = txt

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

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

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

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

j.p = e
j.r = b
j.v = k
m.q = b
m.o = c
m.v = f
e.w = h
e.r = m
e.q = i
h.t = e
h.z = e
h.x = j
h.w = c
b.p = e
b.r = j
b.v = f
c.w = i
c.r = m
c.q = h
k.w = n
k.q = n
k.r = m
n.t = f
n.z = f
n.x = b
n.w = c
f.w = n
f.q = n
f.r = m
i.t = k
i.w = k
i.z = e
i.x = j
assert c.q.w.w.w.q.x.v.txt == "f"