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

class B:
    def __init__(self, txt: str):
        self.u: C = None
        self.y: B = None
        self.o: E = None
        self.q: A = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.o: B = None
        self.p: F = None
        self.q: C = None
        self.y: A = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.w: E = None
        self.u: F = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.u: C = None
        self.y: B = None
        self.o: E = None
        self.q: A = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.o: B = None
        self.p: F = None
        self.q: C = None
        self.y: A = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.w: E = None
        self.u: F = None
        self.txt = txt

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

f.z = k
c.u = d
c.y = i
c.o = m
c.q = f
d.z = h
j.t = k
j.o = f
j.x = d
m.o = i
m.p = h
m.q = d
m.y = f
h.t = i
k.w = m
k.u = h
b.z = k
i.u = d
i.y = c
i.o = m
i.q = b
assert d.z.t.y.u.z.t.q.txt == "b"