class A:
    def __init__(self, txt: str):
        self.r: F = None
        self.t: F = None
        self.o: C = None
        self.s: F = None
        self.v: B = None
        self.z: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.z: E = None
        self.q: A = None
        self.w: F = None
        self.r: D = None
        self.y: F = None
        self.s: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: D = None
        self.q: D = None
        self.y: D = None
        self.t: F = None
        self.r: F = None
        self.txt = txt

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

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

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

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

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

d.r = k
d.t = k
d.s = k
d.o = l
d.z = l
d.v = i
i.t = d
i.q = d
i.z = h
i.w = k
i.y = k
i.r = m
i.s = c
l.p = m
l.q = m
l.y = m
l.t = k
l.r = k
m.t = d
m.s = c
h.s = c
k.o = c
c.r = l
assert c.r.p.t.s.o.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: F = None
        self.t: F = None
        self.o: C = None
        self.s: F = None
        self.v: B = None
        self.z: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.z: E = None
        self.q: A = None
        self.w: F = None
        self.r: D = None
        self.y: F = None
        self.s: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: D = None
        self.q: D = None
        self.y: D = None
        self.t: F = None
        self.r: F = None
        self.txt = txt

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

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

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

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

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

d.r = k
d.t = k
d.s = k
d.o = l
d.z = l
d.v = i
i.t = d
i.q = d
i.z = h
i.w = k
i.y = k
i.r = m
i.s = c
l.p = m
l.q = m
l.y = m
l.t = k
l.r = k
m.t = d
m.s = c
h.s = c
k.o = c
c.r = l
assert c.r.p.t.s.o.r.txt == "l"