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

class B:
    def __init__(self, txt: str):
        self.p: D = None
        self.v: F = None
        self.s: A = None
        self.z: A = None
        self.r: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.w: G = None
        self.o: C = None
        self.v: G = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.p: D = None
        self.v: F = None
        self.s: A = None
        self.z: A = None
        self.r: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.w: G = None
        self.o: C = None
        self.v: G = None
        self.txt = txt

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

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

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

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

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