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

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

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

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

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

c.p = f
c.v = f
c.r = b
c.t = n
g.x = f
g.s = f
g.q = d
j.w = d
b.t = n
b.o = f
b.w = m
m.w = c
d.p = f
d.v = b
d.r = b
d.t = n
i.w = c
n.p = f
n.r = f
n.v = b
n.t = d
a.x = f
a.s = b
a.q = n
f.t = n
f.o = b
f.w = m
assert a.q.r.t.v.o.o.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.v: D = None
        self.r: D = None
        self.t: A = None
        self.txt = txt

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

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

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

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

c.p = f
c.v = f
c.r = b
c.t = n
g.x = f
g.s = f
g.q = d
j.w = d
b.t = n
b.o = f
b.w = m
m.w = c
d.p = f
d.v = b
d.r = b
d.t = n
i.w = c
n.p = f
n.r = f
n.v = b
n.t = d
a.x = f
a.s = b
a.q = n
f.t = n
f.o = b
f.w = m
assert a.q.r.t.v.o.o.w.w.txt == "c"