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

class B:
    def __init__(self, txt: str):
        self.q: G = None
        self.y: A = None
        self.p: A = None
        self.x: F = None
        self.w: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.x: C = None
        self.z: D = None
        self.q: A = None
        self.s: C = None
        self.r: C = None
        self.txt = txt

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.q: G = None
        self.y: A = None
        self.p: A = None
        self.x: F = None
        self.w: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.x: C = None
        self.z: D = None
        self.q: A = None
        self.s: C = None
        self.r: C = None
        self.txt = txt

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

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

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

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