class A:
    def __init__(self, txt: str):
        self.r: G = None
        self.q: B = None
        self.x: B = None
        self.z: D = None
        self.w: D = None
        self.u: G = None
        self.o: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: C = None
        self.x: G = None
        self.w: E = None
        self.z: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.s: C = None
        self.t: A = None
        self.z: D = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.o: C = None
        self.y: D = None
        self.v: F = None
        self.r: D = None
        self.txt = txt

c = A("c")
n = B("n")
h = C("h")
b = D("b")
i = E("i")
a = F("a")
f = G("f")

c.r = f
c.u = f
c.q = n
c.x = n
c.o = n
c.z = b
c.w = b
n.s = h
n.x = f
n.w = i
n.z = i
h.v = i
h.o = i
b.v = i
i.u = c
i.t = c
i.s = h
i.z = b
a.p = n
f.o = h
f.y = b
f.r = b
f.v = a
assert h.o.t.u.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: G = None
        self.q: B = None
        self.x: B = None
        self.z: D = None
        self.w: D = None
        self.u: G = None
        self.o: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: C = None
        self.x: G = None
        self.w: E = None
        self.z: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.s: C = None
        self.t: A = None
        self.z: D = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.o: C = None
        self.y: D = None
        self.v: F = None
        self.r: D = None
        self.txt = txt

c = A("c")
n = B("n")
h = C("h")
b = D("b")
i = E("i")
a = F("a")
f = G("f")

c.r = f
c.u = f
c.q = n
c.x = n
c.o = n
c.z = b
c.w = b
n.s = h
n.x = f
n.w = i
n.z = i
h.v = i
h.o = i
b.v = i
i.u = c
i.t = c
i.s = h
i.z = b
a.p = n
f.o = h
f.y = b
f.r = b
f.v = a
assert h.o.t.u.r.txt == "b"