class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: G = None
        self.w: A = None
        self.x: B = None
        self.u: B = None
        self.txt = txt

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

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

e = A("e")
d = B("d")
a = C("a")
m = D("m")
i = E("i")
h = F("h")
b = G("b")
f = D("f")
c = E("c")
g = A("g")

e.u = m
d.u = e
d.r = b
a.v = d
m.r = i
m.o = e
m.w = c
i.p = b
i.w = g
i.x = d
i.u = d
h.u = g
b.o = e
b.u = g
b.t = g
f.r = i
f.o = e
f.w = c
c.p = b
c.w = e
c.x = d
c.u = d
g.u = f
assert f.w.u.r.t.u.r.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: G = None
        self.w: A = None
        self.x: B = None
        self.u: B = None
        self.txt = txt

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

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

e = A("e")
d = B("d")
a = C("a")
m = D("m")
i = E("i")
h = F("h")
b = G("b")
f = D("f")
c = E("c")
g = A("g")

e.u = m
d.u = e
d.r = b
a.v = d
m.r = i
m.o = e
m.w = c
i.p = b
i.w = g
i.x = d
i.u = d
h.u = g
b.o = e
b.u = g
b.t = g
f.r = i
f.o = e
f.w = c
c.p = b
c.w = e
c.x = d
c.u = d
g.u = f
assert f.w.u.r.t.u.r.txt == "i"