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

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

class C:
    def __init__(self, txt: str):
        self.q: A = None
        self.r: F = None
        self.y: D = None
        self.v: E = None
        self.u: D = None
        self.x: B = None
        self.s: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: G = None
        self.s: E = None
        self.t: B = None
        self.txt = txt

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

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.q: A = None
        self.r: F = None
        self.y: D = None
        self.v: E = None
        self.u: D = None
        self.x: B = None
        self.s: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: G = None
        self.s: E = None
        self.t: B = None
        self.txt = txt

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

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

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

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

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