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

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

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

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

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

c = A("c")
d = B("d")
f = C("f")
j = D("j")
m = E("m")
k = D("k")
i = C("i")
g = B("g")

c.u = m
d.v = m
d.u = m
f.o = c
f.x = c
f.w = j
f.r = i
j.p = i
m.u = c
m.w = f
k.p = f
i.o = c
i.x = c
i.w = j
i.r = f
g.v = m
g.u = m
assert f.r.x.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

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

c = A("c")
d = B("d")
f = C("f")
j = D("j")
m = E("m")
k = D("k")
i = C("i")
g = B("g")

c.u = m
d.v = m
d.u = m
f.o = c
f.x = c
f.w = j
f.r = i
j.p = i
m.u = c
m.w = f
k.p = f
i.o = c
i.x = c
i.w = j
i.r = f
g.v = m
g.u = m
assert f.r.x.u.u.txt == "c"