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

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

class C:
    def __init__(self, txt: str):
        self.o: F = None
        self.z: B = None
        self.r: F = None
        self.p: D = None
        self.w: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.t: D = None
        self.z: E = None
        self.p: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: C = None
        self.y: G = None
        self.v: E = None
        self.s: A = None
        self.w: G = None
        self.o: F = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

b = A("b")
l = B("l")
i = C("i")
f = D("f")
j = E("j")
d = F("d")
c = G("c")
a = E("a")
m = F("m")

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

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

class C:
    def __init__(self, txt: str):
        self.o: F = None
        self.z: B = None
        self.r: F = None
        self.p: D = None
        self.w: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.t: D = None
        self.z: E = None
        self.p: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: C = None
        self.y: G = None
        self.v: E = None
        self.s: A = None
        self.w: G = None
        self.o: F = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

b = A("b")
l = B("l")
i = C("i")
f = D("f")
j = E("j")
d = F("d")
c = G("c")
a = E("a")
m = F("m")

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