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

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

class C:
    def __init__(self, txt: str):
        self.t: B = None
        self.u: F = None
        self.r: E = None
        self.y: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: E = None
        self.y: A = None
        self.p: C = None
        self.v: G = None
        self.q: F = None
        self.u: G = None
        self.z: A = None
        self.txt = txt

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

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

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

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

j.x = m
k.p = j
k.v = m
i.t = k
i.u = c
i.r = b
i.y = h
h.x = m
h.y = j
h.z = j
h.p = i
h.v = g
h.u = g
h.q = c
m.u = j
c.p = h
c.t = i
c.x = j
g.q = h
b.u = j
assert c.t.y.u.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: B = None
        self.u: F = None
        self.r: E = None
        self.y: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: E = None
        self.y: A = None
        self.p: C = None
        self.v: G = None
        self.q: F = None
        self.u: G = None
        self.z: A = None
        self.txt = txt

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

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

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

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

j.x = m
k.p = j
k.v = m
i.t = k
i.u = c
i.r = b
i.y = h
h.x = m
h.y = j
h.z = j
h.p = i
h.v = g
h.u = g
h.q = c
m.u = j
c.p = h
c.t = i
c.x = j
g.q = h
b.u = j
assert c.t.y.u.txt == "g"