class A:
    def __init__(self, txt: str):
        self.w: G = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: A = None
        self.p: B = None
        self.t: F = None
        self.u: C = None
        self.x: C = None
        self.s: D = None
        self.o: E = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: B = None
        self.z: A = None
        self.r: A = None
        self.x: G = None
        self.y: D = None
        self.p: E = None
        self.txt = txt

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

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: A = None
        self.p: B = None
        self.t: F = None
        self.u: C = None
        self.x: C = None
        self.s: D = None
        self.o: E = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: B = None
        self.z: A = None
        self.r: A = None
        self.x: G = None
        self.y: D = None
        self.p: E = None
        self.txt = txt

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

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

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