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

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

class C:
    def __init__(self, txt: str):
        self.q: F = None
        self.t: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: B = None
        self.p: C = None
        self.t: C = None
        self.r: F = None
        self.q: E = None
        self.w: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: C = None
        self.p: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.v: B = None
        self.w: B = None
        self.txt = txt

h = A("h")
j = B("j")
b = C("b")
m = D("m")
e = E("e")
l = F("l")
g = G("g")
c = G("c")
i = E("i")
d = D("d")

h.p = j
h.r = e
j.q = d
j.v = m
b.q = l
b.t = h
m.q = d
m.p = d
m.t = l
m.v = j
e.s = j
e.p = b
e.t = b
e.w = b
e.r = l
e.q = i
l.q = b
l.p = b
g.v = j
g.w = j
c.v = j
c.w = j
i.s = j
i.p = b
i.t = b
i.w = b
i.r = l
i.q = e
d.q = m
d.p = m
d.t = l
d.v = j
assert m.v.q.p.v.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.r: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: F = None
        self.t: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: B = None
        self.p: C = None
        self.t: C = None
        self.r: F = None
        self.q: E = None
        self.w: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: C = None
        self.p: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.v: B = None
        self.w: B = None
        self.txt = txt

h = A("h")
j = B("j")
b = C("b")
m = D("m")
e = E("e")
l = F("l")
g = G("g")
c = G("c")
i = E("i")
d = D("d")

h.p = j
h.r = e
j.q = d
j.v = m
b.q = l
b.t = h
m.q = d
m.p = d
m.t = l
m.v = j
e.s = j
e.p = b
e.t = b
e.w = b
e.r = l
e.q = i
l.q = b
l.p = b
g.v = j
g.w = j
c.v = j
c.w = j
i.s = j
i.p = b
i.t = b
i.w = b
i.r = l
i.q = e
d.q = m
d.p = m
d.t = l
d.v = j
assert m.v.q.p.v.txt == "j"