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

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

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

class D:
    def __init__(self, txt: str):
        self.y: A = None
        self.w: G = None
        self.o: C = None
        self.x: B = None
        self.txt = txt

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

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

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.y: A = None
        self.w: G = None
        self.o: C = None
        self.x: B = None
        self.txt = txt

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

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

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

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

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