class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.s: E = None
        self.o: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.t: E = None
        self.o: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: E = None
        self.w: C = None
        self.p: A = None
        self.u: E = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

j = A("j")
b = B("b")
l = C("l")
n = D("n")
d = E("d")
k = F("k")
f = G("f")
a = F("a")
g = E("g")

j.r = n
j.s = d
j.o = k
b.s = f
l.u = n
l.s = n
l.r = j
n.q = j
n.t = g
n.o = b
d.o = g
d.u = g
d.w = l
d.p = j
k.w = n
k.t = d
k.x = d
k.v = a
f.t = l
a.w = n
a.t = g
a.v = k
a.x = d
g.o = d
g.u = d
g.w = l
g.p = j
assert g.w.r.s.w.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.s: E = None
        self.o: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.t: E = None
        self.o: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: E = None
        self.w: C = None
        self.p: A = None
        self.u: E = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

j = A("j")
b = B("b")
l = C("l")
n = D("n")
d = E("d")
k = F("k")
f = G("f")
a = F("a")
g = E("g")

j.r = n
j.s = d
j.o = k
b.s = f
l.u = n
l.s = n
l.r = j
n.q = j
n.t = g
n.o = b
d.o = g
d.u = g
d.w = l
d.p = j
k.w = n
k.t = d
k.x = d
k.v = a
f.t = l
a.w = n
a.t = g
a.v = k
a.x = d
g.o = d
g.u = d
g.w = l
g.p = j
assert g.w.r.s.w.r.txt == "j"