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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: F = None
        self.r: B = None
        self.t: 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.u: A = None
        self.s: A = None
        self.r: C = None
        self.txt = txt

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

d.u = i
d.t = l
c.u = l
c.o = l
k.z = l
k.r = i
k.p = g
f.w = i
f.o = d
f.t = l
i.u = l
i.r = c
i.t = d
l.t = c
g.u = d
g.s = d
g.r = k
assert d.t.t.u.t.u.t.txt == "
class A:
    def __init__(self, txt: str):
        self.u: E = None
        self.t: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: F = None
        self.r: B = None
        self.t: 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.u: A = None
        self.s: A = None
        self.r: C = None
        self.txt = txt

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

d.u = i
d.t = l
c.u = l
c.o = l
k.z = l
k.r = i
k.p = g
f.w = i
f.o = d
f.t = l
i.u = l
i.r = c
i.t = d
l.t = c
g.u = d
g.s = d
g.r = k
assert d.t.t.u.t.u.t.txt == "c"