class A:
    def __init__(self, txt: str):
        self.v: E = None
        self.y: F = None
        self.r: E = None
        self.w: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: A = None
        self.y: F = None
        self.q: A = None
        self.s: A = None
        self.w: F = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.t: B = None
        self.y: F = None
        self.r: F = None
        self.z: D = None
        self.w: D = None
        self.q: F = None
        self.txt = txt

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

b = A("b")
m = B("m")
j = C("j")
g = D("g")
h = E("h")
d = F("d")
n = E("n")
f = D("f")

b.v = h
b.y = d
b.r = n
b.w = m
m.r = b
m.q = b
m.s = b
m.y = d
m.w = d
j.p = m
j.r = m
j.o = b
j.t = d
j.q = d
g.p = h
g.v = n
g.r = b
h.t = m
h.y = d
h.r = d
h.q = d
h.z = g
h.w = f
d.v = f
n.t = m
n.y = d
n.r = d
n.q = d
n.z = f
n.w = g
f.p = n
f.v = n
f.r = b
assert g.v.w.p.w.r.txt == "
class A:
    def __init__(self, txt: str):
        self.v: E = None
        self.y: F = None
        self.r: E = None
        self.w: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: A = None
        self.y: F = None
        self.q: A = None
        self.s: A = None
        self.w: F = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.t: B = None
        self.y: F = None
        self.r: F = None
        self.z: D = None
        self.w: D = None
        self.q: F = None
        self.txt = txt

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

b = A("b")
m = B("m")
j = C("j")
g = D("g")
h = E("h")
d = F("d")
n = E("n")
f = D("f")

b.v = h
b.y = d
b.r = n
b.w = m
m.r = b
m.q = b
m.s = b
m.y = d
m.w = d
j.p = m
j.r = m
j.o = b
j.t = d
j.q = d
g.p = h
g.v = n
g.r = b
h.t = m
h.y = d
h.r = d
h.q = d
h.z = g
h.w = f
d.v = f
n.t = m
n.y = d
n.r = d
n.q = d
n.z = f
n.w = g
f.p = n
f.v = n
f.r = b
assert g.v.w.p.w.r.txt == "b"