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

class B:
    def __init__(self, txt: str):
        self.s: D = None
        self.v: A = None
        self.t: G = None
        self.u: F = None
        self.y: C = None
        self.txt = txt

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

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

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

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

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

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

g.o = f
c.s = f
c.v = g
c.t = j
c.u = a
c.y = b
b.y = g
b.q = g
b.r = g
b.s = f
f.w = a
h.s = g
a.t = c
a.v = b
a.y = g
j.t = f
j.x = e
e.t = f
e.x = j
assert j.x.x.t.w.t.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: D = None
        self.v: A = None
        self.t: G = None
        self.u: F = None
        self.y: C = None
        self.txt = txt

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

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

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

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

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

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

g.o = f
c.s = f
c.v = g
c.t = j
c.u = a
c.y = b
b.y = g
b.q = g
b.r = g
b.s = f
f.w = a
h.s = g
a.t = c
a.v = b
a.y = g
j.t = f
j.x = e
e.t = f
e.x = j
assert j.x.x.t.w.t.txt == "c"