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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: C = None
        self.t: D = None
        self.p: B = None
        self.x: C = None
        self.s: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: D = None
        self.z: A = None
        self.u: E = None
        self.txt = txt

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

a = A("a")
n = B("n")
j = C("j")
h = D("h")
k = E("k")
f = F("f")
m = G("m")
i = A("i")
c = C("c")
d = C("d")

a.w = n
a.x = h
a.z = h
a.y = m
a.s = f
n.y = c
j.t = d
h.y = i
h.x = f
k.w = j
k.t = h
k.p = n
k.s = n
k.x = c
f.y = h
f.z = i
f.u = k
m.p = f
i.w = n
i.x = h
i.z = h
i.y = m
i.s = f
c.t = d
d.t = j
assert j.t.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.x: D = None
        self.y: G = None
        self.z: D = None
        self.s: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: C = None
        self.t: D = None
        self.p: B = None
        self.x: C = None
        self.s: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: D = None
        self.z: A = None
        self.u: E = None
        self.txt = txt

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

a = A("a")
n = B("n")
j = C("j")
h = D("h")
k = E("k")
f = F("f")
m = G("m")
i = A("i")
c = C("c")
d = C("d")

a.w = n
a.x = h
a.z = h
a.y = m
a.s = f
n.y = c
j.t = d
h.y = i
h.x = f
k.w = j
k.t = h
k.p = n
k.s = n
k.x = c
f.y = h
f.z = i
f.u = k
m.p = f
i.w = n
i.x = h
i.z = h
i.y = m
i.s = f
c.t = d
d.t = j
assert j.t.t.t.t.txt == "j"