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

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

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

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

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

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

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

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

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

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

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