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

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

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

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

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

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

a = A("a")
g = B("g")
n = C("n")
e = D("e")
i = E("i")
b = F("b")
l = F("l")

a.p = e
a.r = n
g.w = b
g.v = a
n.w = g
n.y = g
n.r = g
e.t = g
e.y = g
e.r = a
e.w = b
i.y = n
i.t = e
i.r = g
b.s = a
b.q = a
b.t = i
b.w = g
l.s = a
l.q = a
l.t = i
l.w = g
assert a.p.r.r.w.w.q.r.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.r: C = None
        self.txt = txt

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

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

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

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

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

a = A("a")
g = B("g")
n = C("n")
e = D("e")
i = E("i")
b = F("b")
l = F("l")

a.p = e
a.r = n
g.w = b
g.v = a
n.w = g
n.y = g
n.r = g
e.t = g
e.y = g
e.r = a
e.w = b
i.y = n
i.t = e
i.r = g
b.s = a
b.q = a
b.t = i
b.w = g
l.s = a
l.q = a
l.t = i
l.w = g
assert a.p.r.r.w.w.q.r.txt == "n"