class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.x: A = None
        self.o: G = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.s: C = None
        self.q: D = None
        self.u: G = None
        self.txt = txt

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

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.s: C = None
        self.q: D = None
        self.u: G = None
        self.txt = txt

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

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

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