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

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

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

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

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

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

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

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

j.x = a
a.r = j
a.x = j
a.v = j
a.y = j
a.w = d
a.z = k
c.w = l
k.x = d
d.o = c
d.s = e
d.p = a
e.s = k
e.r = h
g.r = e
l.x = d
h.r = e
assert c.w.x.p.x.x.x.x.z.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

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

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

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

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

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

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

j.x = a
a.r = j
a.x = j
a.v = j
a.y = j
a.w = d
a.z = k
c.w = l
k.x = d
d.o = c
d.s = e
d.p = a
e.s = k
e.r = h
g.r = e
l.x = d
h.r = e
assert c.w.x.p.x.x.x.x.z.txt == "k"