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

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

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

class D:
    def __init__(self, txt: str):
        self.x: A = None
        self.z: F = None
        self.q: B = None
        self.p: A = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.x: C = None
        self.u: C = None
        self.v: C = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.x: A = None
        self.z: F = None
        self.q: B = None
        self.p: A = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.x: C = None
        self.u: C = None
        self.v: C = None
        self.txt = txt

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

e.r = h
g.v = e
g.y = c
a.x = k
i.x = e
i.p = e
i.z = b
i.q = g
h.r = a
b.s = a
c.x = a
c.u = a
c.v = a
k.x = e
k.p = e
k.z = b
k.q = g
assert c.x.x.z.txt == "b"